Control Key + another key functionality - AGAIN!

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
 
N

n!

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!
 
G

Guest

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...
 
S

sho_nuff

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top