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 }

 

posted @ 2018-09-16 11:53  蜗牛弟弟  阅读(3401)  评论(0编辑  收藏  举报