G
Guest
I have a class that derives from a Windows forms datagrid and of instance of
this class is hosted within a Windows forms user control. In the derived
class, I have overridden the ProcessDialogKey method and the
PreProcessMessage methods in hopes of trapping a press of the up and down
arrow keys. However, these methods never execute. It seems something else
is intercepting those key strokes, but I am at a loss.
What am I missing?
Thanks for you help.
Chris
Here is the code for the overridden methods:
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Down || keyData == Keys.Up)
{
MessageBox.Show("ProcessDialogKey: " + keyData.ToString());
}
return base.ProcessDialogKey (keyData);
}
public override bool PreProcessMessage( ref Message msg )
{
Keys keyCode = (Keys)(int)msg.WParam & Keys.KeyCode;
if(msg.Msg == WM_KEYDOWN && (keyCode == Keys.Down || keyCode == Keys.Up) )
{
MessageBox.Show("PreProcessMessage: " + keyCode.ToString());
}
return base.PreProcessMessage(ref msg);
}
this class is hosted within a Windows forms user control. In the derived
class, I have overridden the ProcessDialogKey method and the
PreProcessMessage methods in hopes of trapping a press of the up and down
arrow keys. However, these methods never execute. It seems something else
is intercepting those key strokes, but I am at a loss.
What am I missing?
Thanks for you help.
Chris
Here is the code for the overridden methods:
protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Down || keyData == Keys.Up)
{
MessageBox.Show("ProcessDialogKey: " + keyData.ToString());
}
return base.ProcessDialogKey (keyData);
}
public override bool PreProcessMessage( ref Message msg )
{
Keys keyCode = (Keys)(int)msg.WParam & Keys.KeyCode;
if(msg.Msg == WM_KEYDOWN && (keyCode == Keys.Down || keyCode == Keys.Up) )
{
MessageBox.Show("PreProcessMessage: " + keyCode.ToString());
}
return base.PreProcessMessage(ref msg);
}