J
jcrouse
I have the following mouse events assigned to a label control. Is the a way
I can tell which mouse button the users has clicked with?
Private Sub lblP1JoyUp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lblP1JoyUp.Click
If bMouseMove = False Then
If bCtrlKey = True Then
If lblP1JoyUp.BorderStyle = BorderStyle.None Then
lblP1JoyUp.BorderStyle = BorderStyle.FixedSingle
bLabelSelected = True
ElseIf lblP1JoyUp.BorderStyle = BorderStyle.FixedSingle Then
lblP1JoyUp.BorderStyle = BorderStyle.None
bLabelSelected = False
End If
End If
End If
End Sub
Private Sub lblP1JoyUp_MouseDown(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles lblP1JoyUp.MouseDown
myMousedown = lblP1JoyUp.Name
bMouseMove = False
lblP1JoyUp.BringToFront()
clrBGColor = lblP1JoyUp.BackColor
If lblP1JoyUp.BackColor.Equals(Color.Transparent) Then
bTransCk = True
lblP1JoyUp.BackColor = Color.Black
End If
mouseX = Cursor.Position.X - lblP1JoyUp.Location.X
mouseY = Cursor.Position.Y - lblP1JoyUp.Location.Y
lblP1JoyUp.Cursor = Cursors.Hand
End Sub
Private Sub lblP1JoyUp_MouseMove(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles lblP1JoyUp.MouseMove
Dim lblP1JoyUp As Label = DirectCast(sender, Label)
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
If myMousedown = lblP1JoyUp.Name Then
lblP1JoyUp.Location = New
System.Drawing.Point(Cursor.Position.X - mouseX, Cursor.Position.Y - mouseY)
bMouseMove = True
End If
LastCursor = Cursor.Position
End If
End Sub
Private Sub lblP1JoyUp_MouseUp(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles lblP1JoyUp.MouseUp
Dim lblP1JoyUp As Label = DirectCast(sender, Label)
If bTransCk = True Then
lblP1JoyUp.BackColor = Color.Transparent
End If
lblP1JoyUp.BackColor = clrBGColor
myMousedown = ""
lblP1JoyUp.Cursor = Cursors.Default
End Sub
Thank you,
John
I can tell which mouse button the users has clicked with?
Private Sub lblP1JoyUp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles lblP1JoyUp.Click
If bMouseMove = False Then
If bCtrlKey = True Then
If lblP1JoyUp.BorderStyle = BorderStyle.None Then
lblP1JoyUp.BorderStyle = BorderStyle.FixedSingle
bLabelSelected = True
ElseIf lblP1JoyUp.BorderStyle = BorderStyle.FixedSingle Then
lblP1JoyUp.BorderStyle = BorderStyle.None
bLabelSelected = False
End If
End If
End If
End Sub
Private Sub lblP1JoyUp_MouseDown(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles lblP1JoyUp.MouseDown
myMousedown = lblP1JoyUp.Name
bMouseMove = False
lblP1JoyUp.BringToFront()
clrBGColor = lblP1JoyUp.BackColor
If lblP1JoyUp.BackColor.Equals(Color.Transparent) Then
bTransCk = True
lblP1JoyUp.BackColor = Color.Black
End If
mouseX = Cursor.Position.X - lblP1JoyUp.Location.X
mouseY = Cursor.Position.Y - lblP1JoyUp.Location.Y
lblP1JoyUp.Cursor = Cursors.Hand
End Sub
Private Sub lblP1JoyUp_MouseMove(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.MouseEventArgs) Handles lblP1JoyUp.MouseMove
Dim lblP1JoyUp As Label = DirectCast(sender, Label)
Static LastCursor As Point
Dim NowCursor As Point = New Point(Cursor.Position.X,
Cursor.Position.Y)
If Point.op_Inequality(NowCursor, LastCursor) Then
If myMousedown = lblP1JoyUp.Name Then
lblP1JoyUp.Location = New
System.Drawing.Point(Cursor.Position.X - mouseX, Cursor.Position.Y - mouseY)
bMouseMove = True
End If
LastCursor = Cursor.Position
End If
End Sub
Private Sub lblP1JoyUp_MouseUp(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles lblP1JoyUp.MouseUp
Dim lblP1JoyUp As Label = DirectCast(sender, Label)
If bTransCk = True Then
lblP1JoyUp.BackColor = Color.Transparent
End If
lblP1JoyUp.BackColor = clrBGColor
myMousedown = ""
lblP1JoyUp.Cursor = Cursors.Default
End Sub
Thank you,
John