c# 键值对照表
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.InteropServices;namespace DataMigrationClient{public class API{public const int VK_LCONTROL = 162
·
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace DataMigrationClient
{
public class API
{
public const int VK_LCONTROL = 162;
public const int VK_RCONTROL = 163;
/// <summary>
/// 左Shift键
/// </summary>
public const int VK_LSHIFT = 160;
/// <summary>
/// 右Shift键
/// </summary>
public const int VK_RSHIFT = 161;
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetAsyncKeyState")]
public static extern short GetAsyncKeyState(int vKey);
}
}
//获取值
short value= API.GetAsyncKeyState(API.VK_LCONTROL);
c# 键值对照表
虚拟键值表 | |||
虚拟键 | 十六进制值 | 十进制值 | 相应键盘或鼠标键 |
VK_LBUTTON | 1 | 1 | 鼠标左键 |
VK_RBUTTON | 2 | 2 | 鼠标右键 |
VK_CANCEL | 3 | 3 | Ctrl-Break键 |
VK_MBUTTON | 4 | 4 | 鼠标中键 |
VK_BACK | 8 | 8 | Backspace键 |
VK_TAB | 9 | 9 | Tab键 |
VK_CLEAR | 0C | 12 | Clear键 |
VK_RETURN | 0D | 13 | Enter键 |
VK_SHIFT | 10 | 16 | Shift键 |
VK_CONTROL | 11 | 17 | Ctrl键 |
VK_MENU | 12 | 18 | Alt键 |
VK_PAUSE | 13 | 19 | Pause键 |
VK_CAPITAL | 14 | 20 | Caps Lock键 |
VK_ESCAPE | 1B | 27 | Esc键 |
VK_SPACE | 20 | 32 | Space键 |
VK_PRIOR | 21 | 33 | Page Up键 |
VK_NEXT | 22 | 34 | Page Down键 |
VK_END | 23 | 35 | End键 |
VK_HOME | 24 | 36 | Home键 |
VK_LEFT | 25 | 37 | ←键 |
VK_UP | 26 | 38 | ↑键 |
VK_RIGHT | 27 | 39 | →键 |
VK_DOWN | 28 | 40 | ↓键 |
VK_SELECT | 29 | 41 | Select键 |
VK_PRINT | 2A | 42 | Print键 |
VK_EXECUTE | 2B | 43 | Execute键 |
VK_SNAPSHOT | 2C | 44 | Print Screen键 |
VK_INSERT | 2D | 45 | Ins键 |
VK_DELETE | 2E | 46 | Del键 |
VK_HELP | 2F | 47 | Help键 |
VK_0 | 30 | 48 | 0键 |
VK_1 | 31 | 49 | 1键 |
VK_2 | 32 | 50 | 2键 |
VK_3 | 33 | 51 | 3键 |
VK_4 | 34 | 52 | 4键 |
VK_5 | 35 | 53 | 5键 |
VK_6 | 36 | 54 | 6键 |
VK_7 | 37 | 55 | 7键 |
VK_8 | 38 | 56 | 8键 |
VK_9 | 39 | 57 | 9键 |
VK_A | 41 | 65 | A键 |
VK_B | 42 | 66 | B键 |
VK_C | 43 | 67 | C键 |
VK_D | 44 | 68 | D键 |
VK_E | 45 | 69 | E键 |
VK_F | 46 | 70 | F键 |
VK_G | 47 | 71 | G键 |
VK_H | 48 | 72 | H键 |
VK_I | 49 | 73 | I键 |
VK_J | 4A | 74 | J键 |
VK_K | 4B | 75 | K键 |
VK_L | 4C | 76 | L键 |
VK_M | 4D | 77 | M键 |
VK_N | 4E | 78 | N键 |
VK_O | 4F | 79 | O键 |
VK_P | 50 | 80 | P键 |
VK_Q | 51 | 81 | Q键 |
VK_R | 52 | 82 | R键 |
VK_S | 53 | 83 | S键 |
VK_T | 54 | 84 | T键 |
VK_U | 55 | 85 | U键 |
VK_V | 56 | 86 | V键 |
VK_W | 57 | 87 | W键 |
VK_X | 58 | 88 | X键 |
VK_Y | 59 | 89 | Y键 |
VK_Z | 5A | 90 | Z键 |
VK_LWIN | 5B | 91 | 左Windows键 |
VK_RWIN | 5C | 92 | 右Windows键 |
VK_APPS | 5D | 93 | 应用程序键 |
VK_SLEEP | 5F | 95 | 休眠键 |
VK_NUMPAD0 | 60 | 96 | 小数字键盘0键 |
VK_NUMPAD1 | 61 | 97 | 小数字键盘1键 |
VK_NUMPAD2 | 62 | 98 | 小数字键盘2键 |
VK_NUMPAD3 | 63 | 99 | 小数字键盘3键 |
VK_NUMPAD4 | 64 | 100 | 小数字键盘4键 |
VK_NUMPAD5 | 65 | 101 | 小数字键盘5键 |
VK_NUMPAD6 | 66 | 102 | 小数字键盘6键 |
VK_NUMPAD7 | 67 | 103 | 小数字键盘7键 |
VK_NUMPAD8 | 68 | 104 | 小数字键盘8键 |
VK_NUMPAD9 | 69 | 105 | 小数字键盘9键 |
VK_MULTIPLY | 6A | 106 | 乘号键 |
VK_ADD | 6B | 107 | 加号键 |
VK_SEPARATOR | 6C | 108 | 分割键 |
VK_SUBSTRACT | 6D | 109 | 减号键 |
VK_DECIMAL | 6E | 110 | 小数点键 |
VK_DIVIDE | 6F | 111 | 除号键 |
VK_F1 | 70 | 12 | F1键 |
VK_F2 | 71 | 113 | F2键 |
VK_F3 | 72 | 114 | F3键 |
VK_F4 | 73 | 115 | F4键 |
VK_F5 | 74 | 116 | F5键 |
VK_F6 | 75 | 117 | F6键 |
VK_F7 | 76 | 118 | F7键 |
VK_F8 | 77 | 119 | F8键 |
VK_F9 | 78 | 120 | F9键 |
VK_F10 | 79 | 121 | F10键 |
VK_F11 | 7A | 122 | F11键 |
VK_F12 | 7B | 123 | F12键 |
VK_F13 | 7C | 124 | F13键 |
VK_F14 | 7D | 125 | F14键 |
VK_F15 | 7E | 126 | F15键 |
VK_F16 | 7F | 127 | F16键 |
VK_F17 | 80 | 128 | F17键 |
VK_F18 | 81 | 129 | F18键 |
VK_F19 | 82 | 130 | F19键 |
VK_F20 | 83 | 131 | F20键 |
VK_F21 | 84 | 132 | F21键 |
VK_F22 | 85 | 133 | F22键 |
VK_F23 | 86 | 134 | F23键 |
VK_F24 | 87 | 135 | F24键 |
VK_NUMLOCK | 90 | 144 | Num Lock键 |
VK_SCROLL | 91 | 45 | Scroll Lock键 |
VK_LSHIFT | A0 | 160 | 左Shift键 |
VK_RSHIFT | A1 | 161 | 右Shift键 |
VK_LCONTROL | A2 | 162 | 左Ctrl键 |
VK_RCONTROL | A3 | 163 | 右Ctrl键 |
VK_LMENU | A4 | 164 | 左Alt键 |
VK_RMENU | A5 | 165 | 右Alt键 |
更多推荐
已为社区贡献2条内容
所有评论(0)