質問

I want to be able to show the hotkey combination assigned to a toolstrip menu item in winforms. For instane, in any program (even your browser settings menu) you can see various menu items, and generally, aligned to the right of their item, is their hotkey shortcut. I want to do this programmatically.

Example: Instead of typing

Open a file                         (ctrl+O)

I want to have the properties show up independently of each other.

How can I achieve this?

役に立ちましたか?

解決

You want to you use the ShortcutKeys property of the ToolStripMenuItem. This will let you pick the particular key combination you want for each menu item and it will show up to the right of the menu item. Make sure that you have ShowShortcutKeys property of the ToolStripMenuItem set to true.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top