在C#的窗體程序中,獲得鼠標點擊的事件時,想要得知當前是否有Control鍵,Shift鍵等是否被按下。
1 private void xxx_MouseClick(object sender, MouseEventArgs e) 2 { 3 if ((Control.ModifierKeys & Keys.Control) == Keys.Control)// CTRL is pressed 4 { 5 6 } 7 8 if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) 9 { 10 11 } 12 }