Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top