Is there a way to detect if you click on an object with both mousebuttons, like in minesweep to open all the surrounding spot?
Printable View
Is there a way to detect if you click on an object with both mousebuttons, like in minesweep to open all the surrounding spot?
yes, if you use MouseDown or MouseMove, the variable 'Button' is 3 if both buttons are pressed
If that's true, why doesn't the following code ever produce a msgbox?
Code:Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 3 Then
MsgBox ""
End If
End Sub
I testet it, and the mousdown event does not respond to double clicking....but you can make two variable LeftButton and RightButton, and check if both of them are true...
Something like this....
VB Code:
Option Explicit Dim leftButton As Boolean Dim rightButton As Boolean Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then leftButton = True ElseIf Button = 2 Then rightButton = True End If If leftButton = True And rightButton = True Then Text1.Text = True End If End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then leftButton = False ElseIf Button = 2 Then rightButton = False End If If leftButton = False Or rightButton = False Then Text1.Text = False End If End Sub