当前位置: 首页>>代码示例>>C#>>正文


C# VirtualKey类代码示例

本文整理汇总了C#中VirtualKey的典型用法代码示例。如果您正苦于以下问题:C# VirtualKey类的具体用法?C# VirtualKey怎么用?C# VirtualKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VirtualKey类属于命名空间,在下文中一共展示了VirtualKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsLetter

 public static bool IsLetter(VirtualKey key)
 {
     switch (key)
     {
         case VirtualKey.A:
         case VirtualKey.B:
         case VirtualKey.C:
         case VirtualKey.D:
         case VirtualKey.E:
         case VirtualKey.F:
         case VirtualKey.G:
         case VirtualKey.H:
         case VirtualKey.I:
         case VirtualKey.J:
         case VirtualKey.K:
         case VirtualKey.L:
         case VirtualKey.M:
         case VirtualKey.N:
         case VirtualKey.O:
         case VirtualKey.P:
         case VirtualKey.Q:
         case VirtualKey.R:
         case VirtualKey.S:
         case VirtualKey.T:
         case VirtualKey.U:
         case VirtualKey.V:
         case VirtualKey.W:
         case VirtualKey.X:
         case VirtualKey.Y:
         case VirtualKey.Z:
         case VirtualKey.Space:
             return true;
     }
     return false;
 }
开发者ID:aaronpowell,项目名称:Bob,代码行数:35,代码来源:KeyValidation.cs

示例2: ToChar

        private static char? ToChar(VirtualKey key, bool shift)
        {
            // convert virtual key to char
            if (32 == (int)key)
                return ' ';

            VirtualKey search;

            // look for simple letter
            foreach (var letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
            {
                if (Enum.TryParse<VirtualKey>(letter.ToString(), out search) && search.Equals(key))
                    return (shift) ? letter : letter.ToString().ToLower()[0];
            }

            // look for simple number
            foreach (var number in "1234567890")
            {
                if (Enum.TryParse<VirtualKey>("Number" + number.ToString(), out search) && search.Equals(key))
                    return number;
            }

            // not found
            return null;
        }
开发者ID:wooboo,项目名称:DSM,代码行数:25,代码来源:KeyboardHelper.cs

示例3: KeyInput

 public KeyInput(IntPtr hkl, VirtualKey virtualKey)
 {
     this.m_sc = NativeMethods.MapVirtualKeyExWrapper((uint)virtualKey, MapVirtualKeyMapTypes.MAPVK_VK_TO_VSC_EX, hkl);
     this.m_hkl = hkl;
     this.m_vk = (uint)virtualKey;
     InterrogateKeyboardLayout(this.m_hkl, this.m_vk, this.m_sc);
 }
开发者ID:tqphan,项目名称:Virtual-Keyboard,代码行数:7,代码来源:KeyInput.cs

示例4: Input

 //not sure if I like this pattern
 public void Input(VirtualKey keypress)
 {
     if (keyWaiter != null)
     {
         keyWaiter.TrySetResult(keypress);
     }
 }
开发者ID:paulgmiller,项目名称:Dominoes,代码行数:8,代码来源:HumanPlayer.cs

示例5: IsNumeric

        public static bool IsNumeric(VirtualKey key, bool checkModifiers = true)
        {
            if (checkModifiers && Window.Current.CoreWindow.GetKeyState(VirtualKey.Shift).HasFlag(CoreVirtualKeyStates.Down))
                return false;

            switch (key)
            {
                case VirtualKey.NumberPad0:
                case VirtualKey.NumberPad1:
                case VirtualKey.NumberPad2:
                case VirtualKey.NumberPad3:
                case VirtualKey.NumberPad4:
                case VirtualKey.NumberPad5:
                case VirtualKey.NumberPad6:
                case VirtualKey.NumberPad7:
                case VirtualKey.NumberPad8:
                case VirtualKey.NumberPad9:
                case VirtualKey.Number0:
                case VirtualKey.Number1:
                case VirtualKey.Number2:
                case VirtualKey.Number3:
                case VirtualKey.Number4:
                case VirtualKey.Number5:
                case VirtualKey.Number6:
                case VirtualKey.Number7:
                case VirtualKey.Number8:
                case VirtualKey.Number9:
                    return true;
            }

            return false;
        }
开发者ID:aaronpowell,项目名称:Bob,代码行数:32,代码来源:KeyValidation.cs

示例6: IsHolding

        public bool IsHolding( VirtualKey K )
        {
            if( HoldingKeys.ContainsKey( K ) )
                return HoldingKeys[ K ];

            return false;
        }
开发者ID:tgckpg,项目名称:libpenguin,代码行数:7,代码来源:KeyboardControl.cs

示例7: IsValidHexDigitKey

        public static bool IsValidHexDigitKey(VirtualKey key)
        {
            bool ret =  (key >= VirtualKey.Number0 && key <= VirtualKey.Number9) ||
                (key >= VirtualKey.A && key <= VirtualKey.F);

            return ret;
        }
开发者ID:ccasbre27,项目名称:SmartcardWithWindowsStore,代码行数:7,代码来源:HexHelper.cs

示例8: ToUnicodeEx

 public static extern int ToUnicodeEx(
     uint wVirtKey,
     uint wScanCode,
     VirtualKey[] lpKeyState,
     StringBuilder pwszBuff,
     int cchBuff,
     uint wFlags,
     IntPtr dwhkl);
开发者ID:tqphan,项目名称:Virtual-Keyboard,代码行数:8,代码来源:NativeMethods.cs

示例9: IsNumberKey

 private bool IsNumberKey(VirtualKey inKey)
 {
     if (inKey < VirtualKey.Number0 || inKey > VirtualKey.Number9 && inKey < VirtualKey.NumberPad0 || inKey > VirtualKey.NumberPad9)
     {
         return false;
     }
     return true;
 }
开发者ID:TheAngryByrd,项目名称:MetroPass,代码行数:8,代码来源:NumberBox.cs

示例10: MakeKeyboardSendKeyEventCommand

 public static string MakeKeyboardSendKeyEventCommand(VirtualKey key)
 {
     var args = new KeyboardSendKeyEventArgs()
     {
         Key         = key,
     };
     var argsSerialize = JsonConvert.SerializeObject(args);
     return PluginCommandSerializeMaker.MakeCommand(InnerPluginName, "KeyboardSendKeyEvent", argsSerialize);
 }
开发者ID:shangshen,项目名称:cozy,代码行数:9,代码来源:KeyboardPluginCommand.cs

示例11: KeyBind

 public KeyBind(VirtualKey mainKey,string commandCode)
 {
     this.MainKey = mainKey;
     IsMainKeyOnly = true;
     IsOptionKeyDown = false;
     IsCallBackOn = false;
     
     this.CommandCode = commandCode;
 }
开发者ID:garicchi,项目名称:Neuronia,代码行数:9,代码来源:KeyBind.cs

示例12: KeyDown

 public void KeyDown(VirtualKey vk)
 {
     switch (vk)
     {
         case VirtualKey.Enter:
             if (Select != null) { Select(); }
             break;
     }
 }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:9,代码来源:MenuItem.cs

示例13: KeyPress

        /// <summary>
        /// Calls the Win32 SendInput method with a KeyDown and KeyUp message in the same input sequence in order to simulate a Key PRESS.
        /// </summary>
        /// <param name="keyCode">The <see cref="VirtualKey"/> to press</param>
        public void KeyPress(VirtualKey keyCode)
        {
            var inputList =
                new InputBuilder()
                    .AddKeyDown(keyCode)
                    .AddKeyUp(keyCode)
                    .ToArray();

            SendSimulatedInput(inputList);
        }
开发者ID:burstas,项目名称:rmps,代码行数:14,代码来源:KeyboardSimulator.cs

示例14: SetVirtualKey

    public static void SetVirtualKey(string keyName, float sensitivity = 3f, float gravity = 3f, float deadZone = 0.01f) {
        if(LookupVirtualKeyIndex(keyName) != -1) {
            Debug.LogWarning("That key is already defined: (" + keyName + ")");
            return;
        }

        int index = GetFirstOpenKeySpot();
        virtualKeys[index] = new VirtualKey(keyName, sensitivity, gravity, deadZone);
        virtualKeysStaged[index] = new VirtualKey(keyName, sensitivity, gravity, deadZone);
        virtualKeyIndexers.Add(index);
    }
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:11,代码来源:VirtualKeyManager.cs

示例15: MakeKeyboardEventCommand

 public static string MakeKeyboardEventCommand(VirtualKey key, byte scan, uint flag, uint extraInfo)
 {
     var args = new KeyboardEventArgs()
     {
         Key         = key,
         ScanKey     = scan,
         Flag        = flag,
         ExtraInfo   = extraInfo,
     };
     var argsSerialize = JsonConvert.SerializeObject(args);
     return PluginCommandSerializeMaker.MakeCommand(InnerPluginName, "KeyboardEvent", argsSerialize);
 }
开发者ID:shangshen,项目名称:cozy,代码行数:12,代码来源:KeyboardPluginCommand.cs


注:本文中的VirtualKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。