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

前端 未结 6 1807
礼貌的吻别
礼貌的吻别 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:51

    I got the following code to work in my Click Event.

    if ((Control.MouseButtons == MouseButtons.Right) || (Control.MouseButtons == MouseButtons.Left))
    

    When only one mouse button is being pressed the "Control.MouseButton" assumes the value of "MouseButtons.None"

    But when both the left and right mouse buttons are being pressed the "Control.MouseButton" assumes the value of either "MouseButtons.Right" or "MouseButtons.Left" according to which was pressed first / last (depending on how long time it was between the left and right button being pressed)

提交回复
热议问题