2009-06-09 39 views

回答

2

检查Control.ModifierKeys ...

[STAThread] 
    static void Main(string[] args) 
    { 
     if (Control.ModifierKeys == Keys.ShiftKey) 
     { 
      // Do something special 
     } 
    } 
+0

任何关心解释他们为什么低估了我的答案? – 2009-06-09 11:46:54

13

的ModifierKeys属性看起来理想:

private void Form1_Load(object sender, EventArgs e) 
{ 
    if ((ModifierKeys & Keys.Shift) != 0) 
    { 
     MessageBox.Show("Shift is pressed"); 
    } 
} 
0

我知道这个帖子是相当老了,但我遇到了这个问题,并通过修改固定它杰米代码:

[STAThread] 
static void Main(string[] args) 
{ 
    if (Control.ModifierKeys.ToString() == "Shift") 
    { 
     // Do something special 
    } 
} 
相关问题