• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# VirtualKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: InitCommands

        public static void InitCommands(TextBox input, VirtualKey acceptKey)
        {
            if (acceptKey == VirtualKey.Enter)
            {
                string[] line = input.Text.Split(new string[] { " " }, StringSplitOptions.None);
                string[] args = new string[line.Length - 1];
                Array.Copy(line, 1, args, 0, line.Length - 1);

                if (CommandHandlers.ContainsKey(line[0].ToLower()))
                    CommandHandlers[line[0].ToLower()].Invoke(args);
            }
        }
开发者ID:concept45,项目名称:Arctium-RT,代码行数:12,代码来源:CommandManager.cs


示例17: IsModifier

        public static bool IsModifier(VirtualKey key)
        {
            switch (key)
            {
                case VirtualKey.Shift:
                case VirtualKey.Control:
                case VirtualKey.Tab:
                case VirtualKey.Enter:
                    return true;
            }

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


示例18: IsRelevantKey

		public static bool IsRelevantKey(VirtualKey key)
		{
			switch (key)
			{
				case VirtualKey.A:
				case VirtualKey.D:
				case VirtualKey.Space:
				case VirtualKey.Enter:
				case VirtualKey.R:
					return true;
				default:
					return false;
			}
		}
开发者ID:slanger,项目名称:Win2dFun,代码行数:14,代码来源:InputManager.cs


示例19: KeyDown

 public void KeyDown(VirtualKey vk)
 {
     switch (vk)
     {
         case VirtualKey.Down:
             ScrollDown();
             break;
         case VirtualKey.Up:
             ScrollUp();
             break;
         default:
             if (SelectedItem != null) { SelectedItem.KeyDown(vk); }
             break;
     }
 }
开发者ID:flameeyez,项目名称:win2d_text_game_world_generator,代码行数:15,代码来源:Menu.cs


示例20: KeyboardEventArgs

 private KeyboardEventArgs KeyboardEventArgs(VirtualKey key)
 {
     var alt = (win.GetKeyState(VirtualKey.Menu) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
     var shift = (win.GetKeyState(VirtualKey.Shift) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
     var control = (win.GetKeyState(VirtualKey.Control) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down;
     var windows = ((win.GetKeyState(VirtualKey.LeftWindows) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down)
         || ((win.GetKeyState(VirtualKey.RightWindows) & CoreVirtualKeyStates.Down) == CoreVirtualKeyStates.Down);
     return new KeyboardEventArgs
     {
         AltKey = alt,
         ControlKey = control,
         ShiftKey = shift,
         WindowsKey = windows,
         VirtualKey = key,
         Character = ToChar(key, shift),
     };
 }
开发者ID:Rasetech,项目名称:Template10,代码行数:17,代码来源:KeyboardHelper.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# VirtualKeyCode类代码示例发布时间:2022-05-24
下一篇:
C# Catalog.Model类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap