KeyDown Event does not handle all keys.
I quote the remark from MSDN help for the KeyDown Event located at:
http://msdn2.microsoft.com/en-us/lib...l.keydown.aspx
----------------------------------------------------------
Key events occur in the following order:
KeyDown
KeyPress
KeyUp
To handle keyboard events only at the form level and not enable other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true. Certain
keys, such as the TAB, RETURN, ESCAPE, and arrow keys are handled by
controls automatically. To have these keys raise the KeyDown event, you
must override the IsInputKey method in each control on your form. The
code for the override of the IsInputKey would need to determine if one
of the special keys is pressed and return a value of true.
For more information about handling events, see Consuming Events.
-----------------------------------------------------------------------
ML****@hotmail.com wrote:
I have a control that handles the KeyDown event but it does not seem to
execute when a combination of keys is pressed - like CTRL+Z. If I
press CTRL, it executes. If I press Z, it executes. But the handler
does not see the combination.
Now this control is contained within another control which is contained
within another. The top most control does see the CTRL+Z. I can easily
pass down the key info, but why does the nested control see some keys
events and not others? It would be cleaner if the nested control simply
handled all input.
Thanks,
Mike