大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
直接设置貌似不行 可以在窗体的 KeyDown事件里面写Public Class Form1
创新互联建站专业为企业提供潍坊网站建设、潍坊做网站、潍坊网站设计、潍坊网站制作等企业网站建设、网页设计与制作、潍坊企业网站模板建站服务,十余年潍坊做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("快捷键设置成功")
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.Shift And e.KeyCode = Keys.C Then
Button1_Click(sender, e)
End If
End Sub
End Class
If e.Shift And e.KeyCode = Keys.Tab Then
MsgBox("Is ""Shift+Tab""")
End If
楼上的按了一次A+W后,接下来单按W键就会弹出信息框
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal keyCode As Integer) As Short
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If GetAsyncKeyState(Keys.A) And GetAsyncKeyState(Keys.W) Then
MsgBox("你按下了A+W键")
End If
End Sub
End Class
按照顺序的话,这样写:
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal keyCode As Integer) As Short
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If GetAsyncKeyState(Keys.A) And e.KeyCode = Keys.W Then
MsgBox("你按下了A+W键")
End If
End Sub
End Class
望采纳~
如果是用Alt组合健,最简单的方法就是,在按钮的Text属性里加个符合,比如想用Alt+A来控制Button1的话,就在Button1的Text属性上加一个A即可。比如Text属性是“我是按钮(A)”,如图所示,那么在按下Alt+A就可以执行Button1_Click命令了,呵呵