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


C# VirtualKeys类代码示例

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


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

示例1: KeyDownEvent

 internal KeyDownEvent(Script script, VirtualKeys key)
 {
     this.Script = script;
     this.Conditions = new List<Condition>();
     this.Actions = new List<Action>();
     this.Key = key;
 }
开发者ID:joeyfoo,项目名称:alstom-metropolis-for-openbve,代码行数:7,代码来源:Tags.Events.cs

示例2: Accelerator

        /// <summary>
        ///     Create a new accelerator from the given accelerator key and virtual key combination.
        /// </summary>
        /// <param name="acceleratorKey">
        ///     The accelerator key (Ctrl, Alt, or Shift). Can be combined with | to form more complicated keystrokes
        ///     such as Ctrl + Alt + Space.
        /// </param>
        /// <param name="virtualKey">
        ///     The virtual key code (may not be Ctrl, Alt, or Shift).
        /// </param>
        public Accelerator(AcceleratorKeys acceleratorKey, VirtualKeys virtualKey)
        {
            AcceleratorKey = acceleratorKey;
            VirtualKey = virtualKey;
            Command = Macros.MAKEWORD((byte)AcceleratorKey, (byte)VirtualKey);

            lock(builderLock) {

                //create a string representation of this accelerators keystroke such as "CONTROL + SPACE"
                foreach(var key in acceleratorKeys.Keys) {
                    if(AcceleratorKey.Any(key)) {
                        stringBuilder.Append(acceleratorKeys[key])
                                     .Append(SEPARATOR);
                    }
                }
                stringBuilder.Append(virtualKeys[VirtualKey]);
                str = stringBuilder.ToString();
                stringBuilder.Clear();
            }

            Accel = new ACCEL() {
                fVirt = (byte)(AcceleratorKey | (AcceleratorKeys)VIRTKEY),
                key = (ushort)VirtualKey,
                cmd = Command
            };
        }
开发者ID:CTravis0128,项目名称:Keys,代码行数:36,代码来源:Accelerator.cs

示例3: KeyGesture

 public KeyGesture( VirtualKeys key, ModifierKeys modifiers, string displayString ) {
     if ( displayString == null ) throw new ArgumentNullException( "displayString" );
     if ( !IsValid( key, modifiers ) )
         throw new InvalidOperationException( "KeyGesture is invalid" );
     this._modifiers = modifiers;
     this._key = key;
     this._displayString = displayString;
 }
开发者ID:furesoft,项目名称:consoleframework,代码行数:8,代码来源:KeyGesture.cs

示例4: makeLp

 private static int makeLp(VirtualKeys vk, int wmKey)
 {
     uint scanCode = User32.MapVirtualKey((uint)vk, 0);
     uint lParam = 0;
     lParam = (0x00000001 | (scanCode << 16));
     if (wmKey != WMsg.WM_KEYDOWN)
     {
         lParam |= 0xc0000000;
     }
     return (int)lParam;
 }
开发者ID:alastorid,项目名称:gcac,代码行数:11,代码来源:RingPostM.cs

示例5: KeyDown

 internal override void KeyDown(VirtualKeys key)
 {
     if (key == VirtualKeys.C1) //Mode Up
     {
         if ((int)train.trainModeSelected < train.trainModeCount - 1)
         {
             trainModeNew = train.trainModeSelected + 1;
         }
     }
     else if (key == VirtualKeys.C2) //Mode Down
     {
         if ((int)train.trainModeSelected > 0)
         {
             trainModeNew = train.trainModeSelected - 1;
         }
     }
 }
开发者ID:joeyfoo,项目名称:SgATC,代码行数:17,代码来源:ModeSelector.cs

示例6: RingPst

        public static void RingPst(IntPtr hwnd, VirtualKeys vk, RingPstType keytype)
        {
            switch (keytype)
            {
                case RingPstType.press:
                    User32.PostMessageA((IntPtr)0x00d07aa, (uint)WMsg.WM_KEYDOWN, (int)vk, makeLp(vk, WMsg.WM_KEYDOWN));
                    User32.SendMessage((IntPtr)0x0004095e, (uint)WMsg.WM_KEYDOWN, vk, makeLp(vk, WMsg.WM_KEYDOWN));
                    System.Threading.Thread.Sleep(33);
                    User32.PostMessageA((IntPtr)0x00d07aa, (uint)WMsg.WM_KEYUP, (int)vk, makeLp(vk, WMsg.WM_KEYUP));
                    User32.SendMessage((IntPtr)0x0004095e, (uint)WMsg.WM_KEYUP, vk, makeLp(vk, WMsg.WM_KEYUP));
                    break;
                case RingPstType.down:
                    User32.PostMessageA(hwnd, (uint)WMsg.WM_KEYDOWN, (int)vk, makeLp(vk, WMsg.WM_KEYDOWN));
                    break;
                case RingPstType.up:
                    User32.PostMessageA(hwnd, (uint)WMsg.WM_KEYUP, (int)vk, makeLp(vk, WMsg.WM_KEYUP));
                    break;

            }
        }
开发者ID:alastorid,项目名称:gcac,代码行数:20,代码来源:RingPostM.cs

示例7: KeyUp

		/// <summary>Is called when a key is released.</summary>
		/// <param name="key">The key.</param>
		internal override void KeyUp(VirtualKeys key) {
		}
开发者ID:leezer3,项目名称:OpenBVE,代码行数:4,代码来源:AtsSx.cs

示例8: KeyUp

			/// <summary>Called when a virtual key is released.</summary>
			internal abstract void KeyUp(VirtualKeys key);
开发者ID:leezer3,项目名称:OpenBVE,代码行数:2,代码来源:PluginManager.cs

示例9: Win32GetKeyState

		private extern static short Win32GetKeyState(VirtualKeys nVirtKey);
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:1,代码来源:XplatUIWin32.cs

示例10: KeyUp

		/// <summary>Is called when a virtual key is released.</summary>
		/// <param name="key">The virtual key that was released.</param>
		public void KeyUp(VirtualKeys key) {
			// TODO: Your old KeyUp code goes here.
		}
开发者ID:leezer3,项目名称:OpenBVE,代码行数:5,代码来源:Plugin.cs

示例11: KeyUp

		/// <summary>Is called when a key is released.</summary>
		/// <param name="key">The key.</param>
		internal void KeyUp(VirtualKeys key) {
			foreach (Device device in this.Devices) {
				device.KeyUp(key);
			}
		}
开发者ID:JakubVanek,项目名称:openBVE-1,代码行数:7,代码来源:Train.cs

示例12: KeyDown

		/// <summary>Is called when a key is pressed.</summary>
		/// <param name="key">The key.</param>
		internal override void KeyDown(VirtualKeys key) {
			switch (key) {
				case VirtualKeys.A2:
					// --- acknowledge the EB ---
					if (this.Counter >= TimeUntilBell) {
						this.Counter = 0.0;
					}
					break;
			}
		}
开发者ID:JakubVanek,项目名称:openBVE-1,代码行数:12,代码来源:Eb.cs

示例13: SetState

 public static void SetState(VirtualKeys Key, bool State)
 {
     if (State != GetState(Key))
     {
         keybd_event(
         (byte)Key,
         0x45,
         KEYEVENTF_EXTENDEDKEY | 0,
         0
         );
         keybd_event(
         (byte)Key,
         0x45,
         KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
         0
         );
     }
 }
开发者ID:crazyender,项目名称:Console-Player,代码行数:18,代码来源:Commandor.cs

示例14: GetState

 public static bool GetState(VirtualKeys Key)
 {
     return (GetKeyState((int)Key) == 1);
 }
开发者ID:crazyender,项目名称:Console-Player,代码行数:4,代码来源:Commandor.cs

示例15: IsKeyLocked

		internal static bool IsKeyLocked (VirtualKeys key)
		{
			#if DriverDebug || DriverDebugState
				Console.WriteLine ("IsKeyLocked ({0}): Called, Result={1}", key, driver.IsKeyLocked (key));
			#endif
			return driver.IsKeyLocked (key);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:XplatUI.cs


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