[英]How to check if the mouse moves, while the left mouse button is down, in c#
我需要找到一种方法来检查鼠标是否在c#中移动,而左键是否向下。
Here's an example (WPF): 这是一个例子(WPF):
public MainWindow()
{
InitializeComponent();
this.MouseMove += new MouseEventHandler(MainWindow_MouseMove);
}
void MainWindow_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
//do something
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.