The "&" hotkey does not appear on runtime for winforms. I know there was a similar question about this. However this solution is not satisfactory since I want the hotkey to appear instant without changing any desktop setting. My question is there any way to create a hotkey command inside the code without changing any computer Desktop setting?
-
PLease write your code – Jul 10 '13 at 03:42
-
Could you provide a link to the similar question? – Longball27 Jul 10 '13 at 03:42
-
I think you can just set a different hotkey – Jul 10 '13 at 03:44
-
Longball. check my edit – Ali Çarıkçıoğlu Jul 10 '13 at 03:48
-
Your link provided already the hint if not the answer to your question. – Edper Jul 10 '13 at 03:54
1 Answers
Keyboard accelerators/mnemonics (the things you get by prefixing one of the letters in a control's caption with the ampersand &
) still work, regardless of whether they are underlined in the UI or not.
The underlining was just removed by default in Windows XP to remove visual clutter. You can turn it back on in the Control Panel (the exact procedure varies according to the version of Windows), but that's something the user should do, not the application. (For the programmer's convenience, as your screenshot shows, they're always shown in the VS designer.)
Besides, as soon as the user presses the Alt key to use one of the keyboard accelerators, the underlines will show back up for their convenience. But you don't even need this if you know the accelerator key and just press it.
The point is that you should always create keyboard accelerators for your controls for accessibility reasons. They will just work, regardless of settings. Whether they get used for not is up to the user.

- 239,200
- 50
- 490
- 574