用户登录  |  用户注册
首 页源码下载网络学院最新源码源码排行屏蔽广告
当前位置:新兴网络 > 网络学院 > 编程开发 > Visual Basic

VB KeyCode转换成对应的键值名称函数

减小字体 增大字体 作者:佚名  来源:本站整理  发布时间:2010-08-06 23:29:42
VBScript code复制代码
Public Function KeyCodeToStr(vbKeycode As Integer)

    If vbKeycode > 47 And vbKeycode < 91 Then
        KeyCodeToStr = Chr(vbKeycode)
        Exit Function
    ElseIf vbKeycode > 111 And vbKeycode < 124 Then
        KeyCodeToStr = "F" & vbKeycode - 111
        Exit Function
    End If
   
    Select Case vbKeycode
       
        Case 8
            KeyCodeToStr = "Back"

        Case 9
            KeyCodeToStr = "Tab"

        Case 12
            KeyCodeToStr = "Clear"

        Case 13
            KeyCodeToStr = "Enter"

        Case 16
            KeyCodeToStr = "Shift"

        Case 17
            KeyCodeToStr = "Ctrl"

        Case 18
            KeyCodeToStr = "Alt"

        Case 19
            KeyCodeToStr = "Pause"

        Case 20
            KeyCodeToStr = "Caps Lock"

        Case 27
            KeyCodeToStr = "Esc"

        Case 32
            KeyCodeToStr = "Space"

        Case 33
            KeyCodeToStr = "Page Up"

        Case 34
            KeyCodeToStr = "Page Down"

        Case 35
            KeyCodeToStr = "End"

        Case 36
            KeyCodeToStr = "Home"
           
        Case 41
            KeyCodeToStr = "Select"

        Case 42
            KeyCodeToStr = "Print Screen"
           
        Case 43
            KeyCodeToStr = "Execute"

        Case 44
            KeyCodeToStr = "SnapShot"
           
        Case 45
            KeyCodeToStr = "Insert"

        Case 46
            KeyCodeToStr = "Delete"
           
        Case 47
            KeyCodeToStr = "Help"
           
        Case 144
            KeyCodeToStr = "Num Lock"
           
        Case 189
            KeyCodeToStr = "-_"
           
        Case 187
            KeyCodeToStr = "=+"
           
        Case 255
            KeyCodeToStr = "Unknown"
           
        Case 192
            KeyCodeToStr = "`~"
           
        Case 37
            KeyCodeToStr = "Left Arrow"
                       
        Case 38
            KeyCodeToStr = "Up Arrow"
                       
        Case 39
            KeyCodeToStr = "Right Arrow"
                       
        Case 40
            KeyCodeToStr = "Dowm Arrow"
                       
        Case 219
            KeyCodeToStr = "[{"
                       
        Case 221
            KeyCodeToStr = "]}"
                       
        Case 186
            KeyCodeToStr = ";:"
                       
        Case 222
            KeyCodeToStr = "'"""
                       
        Case 220
            KeyCodeToStr = "\|"
                                   
        Case 188
            KeyCodeToStr = ",<"
                       
        Case 190
            KeyCodeToStr = ".>"
                       
        Case 191
            KeyCodeToStr = "/?"
                                   
        Case 193
            KeyCodeToStr = "\"
        Case Else
            KeyCodeToStr = "Unknown"
    End Select

End Function
 

Tags:VB KeyCode 键值

作者:佚名
  • 好的评价 如果您觉得此文章好,就请您
      80%(4)
  • 差的评价 如果您觉得此文章差,就请您
      20%(1)

网络学院评论评论内容只代表网友观点,与本站立场无关!

   评论摘要(共 0 条,得分 0 分,平均 0 分) 查看完整评论