ลองดูพวก Event MouseDown,MouseUp ต่าง ๆ ของ Form ครับ
Code (VB.NET)
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
If e.Button = MouseButtons.Left Then
Button5.Enabled = True
ElseIf e.Button = MouseButtons.Right Then
Button3.Enabled = True
ElseIf e.Button = MouseButtons.Middle Then
Button4.Enabled = True
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
If e.Button = MouseButtons.Left Then
Button5.Enabled = False
ElseIf e.Button = MouseButtons.Right Then
Button3.Enabled = False
ElseIf e.Button = MouseButtons.Middle Then
Button4.Enabled = False
End If
End Sub