码迷,mamicode.com
首页 > Windows程序 > 详细

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

时间:2018-09-16 15:36:58      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:span   sed   .sh   key   color   click   判断   cli   col   

 

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

 

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

标签:span   sed   .sh   key   color   click   判断   cli   col   

原文地址:https://www.cnblogs.com/dj-smile/p/9655752.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!