我想使用C#在Windows窗体应用程序中设计一个快捷键框架。例如" Alt + DE" ,使得第二个快捷键选项是多个字符的组合。有没有办法实现这一目标。
答案 0 :(得分:0)
MSDN:
示例代码:
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.");
}
}