类似于:Get the ID/Name of a button in a click event. VB.NET?
我想查找是否在鼠标上单击了左键或右键。我已经声明了一个包含按钮的块类。我已经为点击按钮分配了一个事件:
Class Block
Public X As Integer
Public Y As Integer
Public type As String
Public status As String
Public text As String
Public WithEvents button As Button
Private Sub btnReveal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button.Click
....
....
End Sub
这样可以正常工作,但是当我尝试选择正确的按钮时,请单击:
If e.Button = MouseButtons.Right Then
MessageBox.Show("RH click")
Else
button.Text = text
button.BackColor = Color.LightGray
End If
它抱怨e.Button: Button不是System.EventArgs
的成员有什么想法吗?