繁体   English   中英

使用 C# 在 Windows 窗体应用程序中创建具有多个字符(ALt+DE)的快捷键

[英]Creating short cut keys with multiple chars(ALt+DE) in windows form application using C#

我想使用 C# 在 windows 窗体应用程序中设计一个快捷键框架。 比如“Alt+DE”这样第二个快捷键选项是多个字符的组合。 有什么办法可以做到这一点。

微软:

https://support.microsoft.com/en-gb/kb/839201

示例代码:

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Alt && e.KeyCode.ToString() == "F")
    {
        // When the user presses both the 'Alt' key and 'F' key,
        // KeyPreview is set to False, and a message appears.
        // This message is only displayed when KeyPreview is set to True.
        this.KeyPreview = true;
        MessageBox.Show("KeyPreview is True, and this is from the FORM.");
    } 
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM