M
mdb
I have a fairly complicated windows forms with user controls and panels and
everything. I'm using KeyPreview in my main form to watch keyboard events
because I need to have some keys that work 'globally'. For example, I need
to catch the '1', '2', '3', and Backspace keys. When these keys are
pressed, my program takes some action.
However, I don't want the program to take action when the user is actually
typing in a textbox. Thus, I need some way to query what the active
control is - at the lowest level. That is, if I have a text box in a user
control inside another user control, I need a function that will return an
instance of 'Control' that indicates what control has focus, no matter how
deep the control is...
-mdb
everything. I'm using KeyPreview in my main form to watch keyboard events
because I need to have some keys that work 'globally'. For example, I need
to catch the '1', '2', '3', and Backspace keys. When these keys are
pressed, my program takes some action.
However, I don't want the program to take action when the user is actually
typing in a textbox. Thus, I need some way to query what the active
control is - at the lowest level. That is, if I have a text box in a user
control inside another user control, I need a function that will return an
instance of 'Control' that indicates what control has focus, no matter how
deep the control is...
-mdb