Setting winforms ToolStripMenuItem ShortcutKeys to numpad key does not work
Posted
by Axarydax
on Stack Overflow
See other posts from Stack Overflow
or by Axarydax
Published on 2010-04-25T16:23:37Z
Indexed on
2010/04/25
22:13 UTC
Read the original article
Hit count: 715
We have the ability to define ShortcutKeys for WinForms application menu items. That way I can tell a menu item File->Save to have a shortcut key Ctrl+S and the menu item's handler is "magically" executed after pressing Ctrl+S.
The trouble is with the numeric keypad keys, the ShortcutKey property does not accept them (I don't understand how are they different from the other acceptable keys.
MSDN states that the property accepts type System.Windows.Forms.Keys (One of the Keys values. The default is None.); and an InvalidEnumArgumentException would be thrown when the parameter is not one of Keys values. But for example Keys.Divide IS one of Keys values, and yet it can't be used.
So how can I set a menu item to have a shortcut for Numpad * or Numpad +? Do I need to handle the key in Form's ProcessCmdKey event?
Thanks
© Stack Overflow or respective owner