C# 句柄Ctrl+;班次+;WinForm中的应用程序

C# 句柄Ctrl+;班次+;WinForm中的应用程序,c#,winforms,keydown,C#,Winforms,Keydown,我试图在WinForm应用程序中捕获Ctrl+Shift+Akeydown事件。这是我到目前为止试过的- if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control && e.Modifiers == Keys.Shift) { this.Close(); } 但它不起作用。我已经设置了KeyPreview=true 有什么想法吗?在您的按键式事件处理程序中: if (e.KeyCode == Keys

我试图在WinForm应用程序中捕获
Ctrl+Shift+A
keydown事件。这是我到目前为止试过的-

if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control && e.Modifiers == Keys.Shift) 
{
    this.Close();
}
但它不起作用。我已经设置了
KeyPreview=true


有什么想法吗?

在您的
按键式事件处理程序中:

if (e.KeyCode == Keys.A && e.Control && e.Shift) {
    // ...
}

我个人认为这是最简单的方法

if (e.Control && e.Shift && e.KeyCode == Keys.A)
{
   this.Close();
}
if (e.Control && e.Shift && e.KeyCode == Keys.A)
{
   this.Close();
}
试试这个:

if (e.KeyCode == Keys.A && e.Modifiers == (Keys.Control | Keys.Shift))
{
     this.Close();
}
或者这个: