Public Class frmTestKey
Private Sub txtTestRegion_KeyDown(ByVal sender As System.Object,_
ByVal e As System.windows.Forms.KeyEventArgs) Handles txtTestRegion.KeyDown
'<Shift>+<Ctrl>+<...>组合测试
If e.Shift And e.Control Then
Select Case e.KeyCode
Case Keys.F1
MsgBox("按<Shift>+<Ctrl>+<F1>")
Case Keys.F2
MsgBox("按<Shift>+<Ctrl>+<F2>")
End Select
Exit Sub
End If
'<Shift>+<...>组合测试
If e.Shift Then
Select Case e.KeyCode
Case Keys.Home
MsgBox("按<Shift>+<HOME>")
Case Keys.End
MsgBox("按<Shift>+<END>")
End Select
Exit Sub
End If
'<Ctrl>+<...>组合测试
If e.Control Then
Select Case e.KeyCode
Case Keys.Add
MsgBox("按<Ctrl>+<+>")
Case Keys.Subtract
MsgBox("按<Ctrl>+<->")
End Select
Exit Sub
End If
'<Alt>+<...>组合测试
If e.Alt Then
Select Case e.KeyCode
Case Keys.Multiply
MsgBox("按<Alt>+<*>")
Case Keys.divIDe
MsgBox("按<Alt>+</>")
End Select
Exit Sub
End If
'<...>测试
Select Case e.KeyCode
Case Keys.left
MsgBox("按<←>")
Case Keys.Right
MsgBox("按<→>")
End Select
lblKeyOther.Text = e.KeyCode
End Sub
Private Sub txtTestRegion_KeyUp(ByVal sender As System.Object,_
ByVal e As System.windows.Forms.KeyEventArgs) Handles txtTestRegion.KeyUp
'<Shift>+<Ctrl>+<...>组合测试
If e.Shift And e.Control Then
Select Case e.KeyCode
Case Keys.F3
MsgBox("松<Shift>+<Ctrl>+<F3>")
Case Keys.F4
MsgBox("松<Shift>+<Ctrl>+<F4>")
End Select
Exit Sub
End If
'<Shift>+<...>组合测试
If e.Shift Then
Select Case e.KeyCode
Case Keys.PageDown
MsgBox("松<Shift>+<PageDown>")
Case Keys.PageUp
MsgBox("松<Shift>+<PageUp>")
End Select
Exit Sub
End If
'<Ctrl>+<...>组合测试
If e.Control Then
Select Case e.KeyCode
Case Keys.Delete
MsgBox("松<Ctrl>+<Delete>")
Case Keys.Insert
MsgBox("松<Ctrl>+<Insert>")
End Select
Exit Sub
End If
'<Alt>+<...>组合测试
If e.Alt Then
Select Case e.KeyCode
Case Keys.D1
MsgBox("松<Alt>+<1>")
Case Keys.D2
MsgBox("松<Alt>+<2>")
End Select
Exit Sub
End If
'<...>测试
Select Case e.KeyCode
Case Keys.Up
MsgBox("松<↑>")
Case Keys.Down
MsgBox("松<↓>")
End Select
End Sub
End Class
总结以上是内存溢出为你收集整理的vb.net 快捷键盘的 *** 作全部内容,希望文章能够帮你解决vb.net 快捷键盘的 *** 作所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)