How to open a toolbar menu by Keyboard short-cuts?

后端 未结 3 707
醉酒成梦
醉酒成梦 2021-01-23 03:13

I have a blank toolbar button on my form and I am adding all its menus and menu items at run-time. I need to add a keyboard shortcut to the menus of this toolbar. How can I do t

3条回答
  •  遇见更好的自我
    2021-01-23 03:35

    You aren't showing much code here on what you are doing. I'll take a stab at it:

    ToolStripMenuItem tsm = new ToolStripMenuItem("&Test Menu");
    tsm.ShortcutKeys = ((Keys)((Keys.Control | Keys.T)));
    

提交回复
热议问题