Get Mouse State without access to MouseEventArgs?

后端 未结 2 1766
旧巷少年郎
旧巷少年郎 2021-01-17 10:21

I have a form with many, many controls. I need to detect if the mouse is down or if it\'s up. Most of the time, I don\'t have MouseEventArgs.

Is the

相关标签:
2条回答
  • 2021-01-17 10:50

    You can try checking with a timer:

    private void timer1_Tick(object sender, EventArgs e) {
      this.Text = "Mouse Is " + (Control.MouseButtons == MouseButtons.Left);
    }
    
    0 讨论(0)
  • 2021-01-17 10:51

    ChecK Control.MouseButtons static property:

    if (Control.MouseButtons == MouseButtons.Left)
    {
    }
    
    0 讨论(0)
提交回复
热议问题