您好我有几个动态创建的按钮,添加了AddHandler事件:
AddHandler btn.MouseDown, AddressOf TaskButtonClicked
在我的TaskButtonClicked事件中,我想知道点击了哪个鼠标按钮(左或右)
对于这个测试,我很高兴得到一个消息框,说明点击了什么类型,即
Private Sub TaskButtonClicked(sender As Object, e As EventArgs)
Dim clickedButton as xxxxxxxxxxxxxxxx
MsgBox(clickedButton)
End Sub
答案 0 :(得分:2)
Private Sub TaskButtonClicked(sender As Object, e As MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Right Then
MsgBox("Right Click")
End If
End Sub