所以我设置了一个程序,所以如果选中复选框1,它会启动me.keypreview并启动timer3。然后我让计时器3检查空格键是否按下,如果是,则启动Timer1。由于某种原因,代码没有拿起空格键被按下而它检测到左键单击,当我尝试点击左键单击时它启动了timer1。
这是我的代码:
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
hotkey = GetAsyncKeyState(Keys.Space)
If CBool(hotkey) = True Then
Timer1.Start()
Else
Timer1.Stop()
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If CheckBox1.Checked = True Then
Me.KeyPreview = True
Timer3.Start()
Else
Me.KeyPreview = False
Timer3.Stop()
End If
End Sub
结束班
有人可以帮忙吗?