[VB6 ] Keycode
用於 KeyDown、KeyUp 事件
範例:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyControl Then MsgBox "您按下了 Ctrl 鍵唷", vbInformation
If KeyCode = 13 Then MsgBox "您按下了 Enter 鍵唷", vbInformation
End Sub
數字鍵/運算元/符號鍵
vbKey0 = 48
vbKey1 = 49
vbKey2 = 50
vbKey3 = 51
vbKey4 = 52
vbKey5 = 53
vbKey6 = 54
vbKey7 = 55
vbKey8 = 56
vbKey9 = 57
數字盤
vbKeyNumpad0 = 96
vbKeyNumpad1 = 97
vbKeyNumpad2 = 98
vbKeyNumpad3 = 99
vbKeyNumpad4 = 100
vbKeyNumpad5 = 101
vbKeyNumpad6 = 102
vbKeyNumpad7 = 103
vbKeyNumpad8 = 104
vbKeyNumpad9 = 105
vbKeyMultiply = 106 *
vbKeyAdd = 107 +
vbKeySeparator = 108 無法偵測
vbKeySubtract = 109 -
vbKeyDecimal = 110 .
vbKeyDivide = 111 /
英文字母鍵
vbKeyA = 65
vbKeyB = 66
vbKeyC = 67
vbKeyD = 68
vbKeyE = 69
vbKeyF = 70
vbKeyG = 71
vbKeyH = 72
vbKeyI = 73
vbKeyJ = 74
vbKeyK = 75
vbKeyL = 76
vbKeyM = 77
vbKeyN = 78
vbKeyO = 79
vbKeyP = 80
vbKeyQ = 81
vbKeyR = 82
vbKeyS = 83
vbKeyT = 84
vbKeyU = 85
vbKeyV = 86
vbKeyW = 87
vbKeyX = 88
vbKeyY = 89
vbKeyZ = 90
vbKeySpace = 32 空白鍵
控制燈
vbKeyNumlock = 144 Num Lock
vbKeyScrollLock = 145 Scroll Lock
vbKeyCapital = 20 Caps Lock
游標控制
vbKeyUp = 38 ↑
vbKeyDown = 40 ↓
vbKeyLeft = 37 ←
vbKeyRight = 39 →
vbKeyHome = 36
vbKeyEnd = 35
vbKeyPageUp = 33
vbKeyPageDown = 34
vbKeyInsert = 45
vbKeyDelete = 46
vbKeyBack = 8 Backspace
vbKeyReturn = 13 Enter
vbKeyTab = 9 無法偵測
控制鍵
vbKeyMenu = 18 Alt
vbKeyControl = 17 Ctrl
vbKeyShift = 16 Shift
vbKeyF1 = 112
vbKeyF2 = 113
vbKeyF3 = 114
vbKeyF4 = 115
vbKeyF5 = 116
vbKeyF6 = 117
vbKeyF7 = 118
vbKeyF8 = 119
vbKeyF9 = 120
vbKeyF10 = 121
vbKeyPause = 19
vbKeyPrint = 42 無法偵測
vbKeyEscape = 27 Esc
vbKeyExecute = 43 鍵盤上沒有對應的按鍵@@"
vbKeySnapshot = 44 鍵盤上沒有對應的按鍵@@"
vbKeyClear = 12 鍵盤上沒有對應的按鍵@@"
vbKeyCancel = 3 鍵盤上沒有對應的按鍵@@"
vbKeySelect = 41 鍵盤上沒有對應的按鍵@@"
滑鼠鍵
vbKeyLButton = 1 左鍵
vbKeyMButton = 4 中鍵
vbKeyRButton = 2 右鍵
--
VB 程式設計 倉木麻衣 PTT 星爺板 行列輸入法
======================================================
Visual_Basic MaiKuraki Stephen Array
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.222.155.162
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章