看看鼠标左键在事件的OnMouseMove按住 [英] See if left mouse button is held down in the OnMouseMove event

查看:217
本文介绍了看看鼠标左键在事件的OnMouseMove按住的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何检测是否鼠标左键被按下了的OnMouseMove 事件控制?

How do I detect if the left mouse button is being held down in the OnMouseMove event for a control?

推荐答案

您事件处理程序的的OnMouseMove事件应该免费获赠 MouseEventArgs 应该告诉你,如果按下左键

Your eventhandler for the OnMouseMove event should recieve a MouseEventArgs that should tell you if the left button is pressed

private void mouseMoveEventHandler(object sender, MouseEventArgs e)
{
   if(e.Button == MouseButtons.Left)
   {
     //do left stuff
   }
   else 
   {
     // do other stuff
   }
}

这篇关于看看鼠标左键在事件的OnMouseMove按住的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆