繁体   English   中英

在c#中如何检查鼠标是否移动,而鼠标左键是否按下

[英]How to check if the mouse moves, while the left mouse button is down, in c#

我需要找到一种方法来检查鼠标是否在c#中移动,而左键是否向下。

这是一个例子(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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM