Question Extended shortcuts on usercontrol

tschoepi

Member
Joined
May 20, 2010
Messages
6
Location
Germany
Programming Experience
10+
Hi everyone,

I'm new to this forum. So, if this question already has been discussed, please give me a hint, where I could find the solution. By the way, I didn't find it by searching the forum.
I'm responsible for a usercontrol (a button). It gives our application a common look and feel and encapsulates some features. One is an enumeration of defined standard buttons, where images and text are defined, e.g. for a save button, including the shortcuts.
Now I have to resolve the problem, that this button e.g. when being a save button should react on typing ctrl+f (anywhere in the form which it is on). Therefore I can’t use events like key_down.
I’ve tried the API RegisterHotKey, but with this I have the problem, that the shortcut also reacts in others applications as typing ctrl+f in Word reacts on starting the search in our application.
Can anyone please help me?

Tanks

Markus
 
If I use events like KeyDown in my UserControl they only will fire, if the control has the focus. But the Shortcuts should work, no matter which control the focus is on.
We could implement this by setting KeyPreview of the form to true and than put the code in the KeyDown event of the form. But then, every one of our developers has to implement this behaviour.
If the functionality is implemented in the UserControl the shortcuts will work as defined and no one has to take care about implementation details.
 
Back
Top