我有一个程序可以检查左键是否按下然后如果按住它就启动一个计时器。我想要的东西如果它检测到右键单击被按下,它会停止左键单击开始的计时器
这是我的代码
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
hotkey = GetAsyncKeyState(Keys.LButton)
If CBool(hotkey) = True Then
Timer1.Start()
Else
Timer1.Stop()
End If
End Sub
出于某种原因,当我使用相同的代码但只是将LButton
更改为RButton
时,它不起作用
答案 0 :(得分:0)
尝试:
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
hotkey = GetAsyncKeyState(Keys.RButton)
If CBool(hotkey) = True Then
Timer1.Stop()
Else
Timer1.Start()
End If
End Sub