本文整理汇总了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;
}
示例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
};
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
}
示例7: KeyUp
/// <summary>Is called when a key is released.</summary>
/// <param name="key">The key.</param>
internal override void KeyUp(VirtualKeys key) {
}
示例8: KeyUp
/// <summary>Called when a virtual key is released.</summary>
internal abstract void KeyUp(VirtualKeys key);
示例9: Win32GetKeyState
private extern static short Win32GetKeyState(VirtualKeys nVirtKey);
示例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.
}
示例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);
}
}
示例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;
}
}
示例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
);
}
}
示例14: GetState
public static bool GetState(VirtualKeys Key)
{
return (GetKeyState((int)Key) == 1);
}
示例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);
}