那么我有这个代码:
Public Sub FuncKeysModule(ByVal value As Keys)
'Check what function key is in a pressed state, and then perform the corresponding action.
Select Case value
Case Keys.F8
spam.Enabled = True
TabControl1.SelectedIndex = 0
state = "Activo"
Case Keys.F9
spam.Enabled = False
TabControl1.SelectedIndex = 1
state = "Parado"
End Select
End Sub
Private Sub frmMain_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
If e.KeyValue = Keys.F1 Or Keys.F2 Or Keys.F3 Or Keys.F4 Or Keys.F5 Or Keys.F6 Or Keys.F7 Or Keys.F8 Or Keys.F9 Or Keys.F10 Or Keys.F11 Or Keys.F12 Then
FuncKeysModule(e.KeyValue)
e.Handled = True
End If
End Sub
当我按 F8 或 F9 时,表单会调用您可以看到的函数。但是我有一个花花公子,如果表单被最小化或未选中(如果我的 TopMost 为 True),我该怎么称呼它?
谢谢。;)
我有这个代码:
但是每次我运行我的项目时都会发生异常,无法设置键盘挂钩
我能做些什么?:S