簡體   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