类似于:在点击事件中获取按钮的 ID/名称。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 的成员
有任何想法吗?