开发者

Two Step Keypress Event on MenuStrip

开发者 https://www.devze.com 2023-01-28 22:41 出处:网络
I am making a Windows Form in C#.I have a menustrip (File, Edit, Tools, etc.) with the following paths:

I am making a Windows Form in C#. I have a menustrip (File, Edit, Tools, etc.) with the following paths: -File->New->NewItem1 -File->New->NewItem2 -File->New->NewItem3

Anyway, I would like to add shortcut keys to each of these "NewItem"s. I want them to be like some of the hotkeys in Visual Studio where you press a series of keys. For example, to expand/unexpand, you press "Ctrl + M" and then while holding "Ctrl" you press "L"

So basically, I want the user to press "Ctrl + N", then rel开发者_JS百科ease N, then press another key to indicate which "NewItem" is selected.

Thanks.

this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));


I belive you can do that by storing the first shortcut in a class field and when the other shortcut is pressed you use them both.

0

精彩评论

暂无评论...
验证码 换一张
取 消