我希望在按下ctrl + alt + z ...时显示登录表单,然后按ctrl + alt + c关闭程序。在计时器使用Heres我试过的..但它不工作..我做错了什么?使用计时器的间隔为5000毫秒。寻求一些帮助。谢谢你
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If My.Computer.Keyboard.CtrlKeyDown And My.Computer.Keyboard.AltKeyDown And RichTextBox1.Text = "z" Then
Me.Hide()
Form1.Show()
ElseIf My.Computer.Keyboard.CtrlKeyDown And My.Computer.Keyboard.AltKeyDown And RichTextBox1.Text = "c" Then
Me.Close()
End If
End Sub
答案 0 :(得分:0)
你不能捕获那样的组合键。这样做......
1)将Form的KeyPreview属性设置为True。
2)在Form的KeyDown事件下添加代码。
Private Sub Form1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.Control And e.Alt And e.KeyCode = Keys.Z Then
MsgBox("Hi")
End If
End Sub