M
mj2736
I created a windows form control that inherits from the standard .Net
DataGridView control, to which I've added custom functionality.
Instead of using the standard control in my applications, I use my
customized version. I have an event handler in the custom control for
the KeyDown event that simulates a double-click on the selected grid
row when the user presses the enter key. This is working just fine.
Now, some screens that are using this custom control handle the grid's
KeyDown event themselves, so in those cases I don't want the KeyDown
event handler in the custom control class to handle the event. Is
there some check I can perform in the custom control, without adding
anything to the screens that use it, to see if the event is already
being handled? Something like this:
private void MyDataGridView_KeyDown(object sender, KeyEventArgs e)
{
if ( /* check if the KeyDown event is already being handled
elsewhere */ )
{
return;
}
else
{
SimulateDoubleClick();
}
}
Apparently, GetInvocationList() is supposed to return all of the
handlers for an event, but "this.KeyDown.GetInvocationList()" does not
compile. Thanks!
DataGridView control, to which I've added custom functionality.
Instead of using the standard control in my applications, I use my
customized version. I have an event handler in the custom control for
the KeyDown event that simulates a double-click on the selected grid
row when the user presses the enter key. This is working just fine.
Now, some screens that are using this custom control handle the grid's
KeyDown event themselves, so in those cases I don't want the KeyDown
event handler in the custom control class to handle the event. Is
there some check I can perform in the custom control, without adding
anything to the screens that use it, to see if the event is already
being handled? Something like this:
private void MyDataGridView_KeyDown(object sender, KeyEventArgs e)
{
if ( /* check if the KeyDown event is already being handled
elsewhere */ )
{
return;
}
else
{
SimulateDoubleClick();
}
}
Apparently, GetInvocationList() is supposed to return all of the
handlers for an event, but "this.KeyDown.GetInvocationList()" does not
compile. Thanks!