我有两个潜艇
Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles KeyHook.KeyDown
和
Private Sub Form1_KeyPressCaps(ByVal key As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.CapsLock Then
If keyStCL = True Then
checkbutton_caps.Checked = False
checkbutton_caps.Image = My.Resources.Resource1.btn_ico_caps_off
'Image.FromFile("resources\btn_ico_caps_off.png")
keyStCL = False
ElseIf keyStCL = False Then
checkbutton_caps.Checked = True
checkbutton_caps.Image = My.Resources.Resource1.btn_ico_caps_on
'Image.FromFile("resources\btn_ico_caps_on.png")
keyStCL = True
End If
End If
End Sub
我想从 kbHook_KeyDown 调用 Form1_KeyPressCaps。我该怎么做。
我试过这个:
Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles KeyHook.KeyDown
Call Form1_KeyPressCaps(Key, New KeyEventArgs)
End Sub
但它不起作用。我收到错误:
未为“Public Sub New(keyData As System.Windows.Forms.Keys)”的参数“keyData”指定参数。
Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles KeyHook.KeyDown
Call Form1_KeyPressCaps(Key, New KeyEventArgs(Key))
End Sub