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

后端 未结 3 704
醉酒成梦
醉酒成梦 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

    In the place of tbrDropDownButton.Text = UCMDefinitions.GetCaption(textId), use tbrDropDownButton.Text = "&" + UCMDefinitions.GetCaption(textId). This will assign the first letter of the menu item as the shortcut key. If there are multiple items with the same shortcut key, the user will have to press Enter after one or more presses of the shortcut key.

提交回复
热议问题