[英]Keyboard sequence shortcuts for menu
I wish to have a sequence shortcut for the program I'm developing (in C# .net) to access various buttons in the menu system. 我希望为我正在开发的程序(在C#.net中)提供一个序列快捷方式,以访问菜单系统中的各种按钮。
For example: Ctrl + W , O 例如: Ctrl + W , O
First, the user would press Ctrl + W , followed by O 首先,用户将按Ctrl + W ,然后按O
Visual studio uses this method for quite a few of it's menu shortcuts. Visual Studio的许多菜单快捷方式都使用此方法。
When I am editing a menu however, I'm limited to only one shortcut Ctrl + W or just O , I cannot sequence them. 但是,在编辑菜单时,只能使用一个快捷键Ctrl + W或仅O ,我无法对它们进行排序。
Is this possible to do with the existing framework? 这可能与现有框架有关吗?
Simply you could do this: 只需执行以下操作即可:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (previousKeyEvent != null)
{
if (previousKeyEvent.Modifiers == Keys.Control && previousKeyEvent.KeyCode == Keys.W && e.KeyCode == Keys.O)
{
MessageBox.Show("Ctrl + W then O");
}
else
{
MessageBox.Show("Not handled");
previousKeyEvent = null;
}
else
previousKeyEvent = e;
}
}
Things to consider 要考虑的事情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.