Control Key + another key functionality - AGAIN!

  • Thread starter Thread starter sho_nuff
  • Start date Start date
S

sho_nuff

Ok, I've done tons of reading on this today and haven't gotten
anything to really work. Here is what i have:

One main Form.
Two main Panels in that form.
These panels contain various controls that can respond to key events
(TreeViews, TextBoxes, etc).

I want an Form wide Key control that handles Ctrl-F to display a
search box.. if the keys pressed are not Ctrl-F then i want the the
Key event to trickle down to the currently focused control.

I've tried combinations of KeyUp, KeyDown, and setting the KeyPreview
property to TRUE in my form.

Is there no easy way to do this? Can anyone help me get started? I'd
prefer to not override too many methods, and instead use KeyUp,
KeyDown, etc.


Much thanks.
SN
 
I want an Form wide Key control that handles Ctrl-F to display a
search box.. if the keys pressed are not Ctrl-F then i want the the
Key event to trickle down to the currently focused control.

Is there a reason you're avoiding adding a menu option with a shortcut key?
If you have a 'Find' menu item, with an event handler, and set its Shortcut
property to System.Windows.Forms.Shortcut.CtrlF it should all 'just work' :)

n!
 
Use the KeyDown Event and you'll get the property Modifiers that tell's you if a control key (like Control, Shift or Alt) are pressed

I hope this help...
 
Well what do you know. I totally didn't see the Shortcut attribute on
the menu item. Thanks, this totally worked fine and was WAY easier
than the hoops i had been jumping through... i was starting to feel
like Flipper.
 
Back
Top