Detect both left and right mouse click at the same time?

前端 未结 6 1838
礼貌的吻别
礼貌的吻别 2020-12-17 01:51

I\'m remaking windows Minesweeper (from XP) and something they had included was that if you click a number with as many flags as it\'s number with the left and right mouse b

6条回答
  •  没有蜡笔的小新
    2020-12-17 02:55

    Another option is to use the static MouseButtons on the System.Windows.Forms.Control class

    This will tell you which mouse buttons are currently pressed so that you can do something like the following:

    ((Control.MouseButtons & MouseButtons.Right) == MouseButtons.Right) &&
    ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left)
    

    You can also check out the MSDN example

提交回复
热议问题