vb.net 鼠标按钮事件和标签的奇怪动作
vb.net weird action with mouse button event and label
我有一个问题,label1.text
需要通过 mouse left button
到达号码 5
点击 label8
来制作,出现 tool strip menu item
,但是即使 5
除了用 mouse right button
单击一次外,它仍然不可见。这是代码:
Private Sub Label8_Click(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Label8.Click
If e.Button = Windows.Forms.MouseButtons.Left Then
Label1.Text = Val(Label1.Text) + 1
Else
If IsNumeric(Label1.Text = 5) Then
CustomizeModeToolStripMenuItem.Visible = True
End If
End If
End Sub
更新:
Private Sub Label8_Click(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Label8.Click
If e.Button = Windows.Forms.MouseButtons.Left And (Label1.Text <> "5") Then
Label1.Text = Val(Label1.Text) + 1
ElseIf (Label1.Text = "5") Then
CustomizeModeToolStripMenuItem.Visible = True
End If
End Sub
您遇到的问题是:
Else
If IsNumeric(Label1.Text = 5) Then
CustomizeModeToolStripMenuItem.Visible = True
End If
End If
您需要右键单击,因为 if statement
占用了所有左键单击。我没有测试它,所以如果有什么不起作用,请说出来,我会修复它。
我有一个问题,label1.text
需要通过 mouse left button
到达号码 5
点击 label8
来制作,出现 tool strip menu item
,但是即使 5
除了用 mouse right button
单击一次外,它仍然不可见。这是代码:
Private Sub Label8_Click(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Label8.Click
If e.Button = Windows.Forms.MouseButtons.Left Then
Label1.Text = Val(Label1.Text) + 1
Else
If IsNumeric(Label1.Text = 5) Then
CustomizeModeToolStripMenuItem.Visible = True
End If
End If
End Sub
更新:
Private Sub Label8_Click(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Label8.Click
If e.Button = Windows.Forms.MouseButtons.Left And (Label1.Text <> "5") Then
Label1.Text = Val(Label1.Text) + 1
ElseIf (Label1.Text = "5") Then
CustomizeModeToolStripMenuItem.Visible = True
End If
End Sub
您遇到的问题是:
Else
If IsNumeric(Label1.Text = 5) Then
CustomizeModeToolStripMenuItem.Visible = True
End If
End If
您需要右键单击,因为 if statement
占用了所有左键单击。我没有测试它,所以如果有什么不起作用,请说出来,我会修复它。