C#, WinForms: Why aren't KeyDown events chaining up to Form? I have to add event handler to each chi
- by blak3r
As i understand it, when a button is pressed it should first invoke the Control which has focus' KeyDown Handler, then it call the KeyDown handler for any Parent controls, all the way up to the main form. The only thing that would stop the chain would be if somewhere 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.