C#, WinForms: What would prevent KeyDown events from chaining up from focused control up to main For
- by blak3r
As i understand it, when a keyboard button is pressed it should invoke the KeyDown event for the control which has focus. Then, the KeyDown for the parent control, so on and so forth until it reaches main form. UNLESS - along the chain one of the EventHandlers did:
e.SuppressKeyPress = true;
e.Handled = true;
In my case, KeyDown events never get to the main form.
I have Form - Panel - button for example.
Panel doesn't offer a KeyDown Event, but it shouldn't stop it from reaching the main form right?
Right now as a work around I set every single control to call an event handler I wrote. I'm basically trying to prevent Alt-F4 from closing the application and instead minimize it.