How can I show and hide a form with the same key F1

abdalwahd

New member
Joined
Jul 8, 2022
Messages
3
Programming Experience
3-5
Hello everyone
How can I show or hide a specific form with just one key. For example, when I press "F1" the form appears, and when I press "F1" again, the form disappears
 
Don't use F1, as that is universally the key for Help in Windows. Such shortcuts should pretty much always involve at least one modifier key and preferably multiple, to reduce the chance of a clash with a function of the application with focus. Regardless, you should look into the RegisterHotKey API. That will enable you to register a hotkey with Windows, so you can notified when it is pressed even if your app doesn't have input focus. You should read the relevant documentation and you'll no doubt be able to find a number of examples of its use in C# on the web.
 
Thank you for your interest in the topic
It is possible that there is another key similar to the possible key F12 that does the same function
 
Back
Top Bottom