C# 在获得鼠标点击事件时,如何判断Control键,Shift键被按下

在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 }

猜你喜欢

转载自www.cnblogs.com/dj-smile/p/9655752.html