コード例 #1
0
        public string KeyCodeToString(AllKeys KeyCode)
        {
            string Character = "";

            switch ((int)KeyCode)
            {
                case 0x20:
                    Character = " ";
                    break;
                case 0xDB:
                    Character = "[";
                    break;
                case 0xDD:
                    Character = "]";
                    break;
                case 0xDC:
                    Character = "\\";
                    break;
                case 0xBA:
                    Character = ";";
                    break;
                case 0xDE:
                    Character = "'";
                    break;
                case 0xBF:
                    Character = "/";
                    break;
                case 0xBE:
                    Character = ".";
                    break;
                case 0xBC:
                    Character = ",";
                    break;
                case 0xBD:
                    Character = "-";
                    break;
                case 0xBB:
                    Character = "=";
                    break;
                case 0xC0:
                    Character = "`";
                    break;
                case 0x31:
                    Character = "1";
                    break;
                case 0x32:
                    Character = "2";
                    break;
                case 0x33:
                    Character = "3";
                    break;
                case 0x34:
                    Character = "4";
                    break;
                case 0x35:
                    Character = "5";
                    break;
                case 0x36:
                    Character = "6";
                    break;
                case 0x37:
                    Character = "7";
                    break;
                case 0x38:
                    Character = "8";
                    break;
                case 0x39:
                    Character = "9";
                    break;
                case 0x30:
                    Character = "0";
                    break;
                default:
                    Character = KeyCode.ToString();
                    break;
            }

            if (Character.Length > 1)
            {
                Character = "{" + Character + "}";
            }
            return Character;
        }