本文整理汇总了C#中VirtualKeys类的典型用法代码示例。如果您正苦于以下问题:C# VirtualKeys类的具体用法?C# VirtualKeys怎么用?C# VirtualKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtualKeys类属于命名空间,在下文中一共展示了VirtualKeys类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: MapVirtualKey
internal static extern UINT MapVirtualKey(VirtualKeys vkey, MapVirtualKeyType uMapType);
开发者ID:jpbruyere,项目名称:opentk,代码行数:1,代码来源:API.cs
示例17: KeyDown
internal override void KeyDown(VirtualKeys key)
{
}
开发者ID:joeyfoo,项目名称:SgATC,代码行数:3,代码来源:Mode_ATO.cs
示例18: SendKeyboardInput
private MSG SendKeyboardInput (VirtualKeys vkey, int scan, int keycode, KeybdEventFlags dw_flags, int time)
{
Msg message;
if ((dw_flags & KeybdEventFlags.KeyUp) != 0) {
bool sys_key = (key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0 &&
((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) == 0);
key_state_table [(int) vkey] &= unchecked ((byte) ~0x80);
message = (sys_key ? Msg.WM_SYSKEYUP : Msg.WM_KEYUP);
} else {
if ((key_state_table [(int) vkey] & 0x80) == 0) {
key_state_table [(int) vkey] ^= 0x01;
}
key_state_table [(int) vkey] |= 0x80;
bool sys_key = (key_state_table [(int) VirtualKeys.VK_MENU] & 0x80) != 0 &&
((key_state_table [(int) VirtualKeys.VK_CONTROL] & 0x80) == 0);
message = (sys_key ? Msg.WM_SYSKEYDOWN : Msg.WM_KEYDOWN);
}
MSG msg = new MSG ();
msg.message = message;
msg.wParam = (IntPtr) vkey;
msg.lParam = GenerateLParam (msg, keycode);
return msg;
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:25,代码来源:X11Keyboard.cs
示例19: KeyDown
/// <summary>Is called when a key is pressed.</summary>
/// <param name="key">The key.</param>
internal void KeyDown(VirtualKeys key) {
if (key == VirtualKeys.D) {
// --- enable safety systems ---
if (this.AtsSx != null) {
if (this.AtsSx.State == AtsSx.States.Disabled) {
this.AtsSx.State = AtsSx.States.Suppressed;
}
}
if (this.AtsP != null) {
if (this.AtsP.State == AtsP.States.Disabled) {
this.AtsP.State = AtsP.States.Suppressed;
}
}
if (this.Atc != null) {
if (this.Atc.State == Atc.States.Disabled) {
this.Atc.State = Atc.States.Suppressed;
}
}
} else if (key == VirtualKeys.E) {
// --- disable safety systems ---
if (this.AtsSx != null) {
if (this.AtsSx.State != AtsSx.States.Disabled) {
this.AtsSx.State = AtsSx.States.Disabled;
}
}
if (this.AtsP != null) {
if (this.AtsP.State != AtsP.States.Disabled) {
this.AtsP.State = AtsP.States.Disabled;
}
}
if (this.Atc != null) {
if (this.Atc.State != Atc.States.Disabled) {
this.Atc.State = Atc.States.Disabled;
}
}
} else {
// --- other functions ---
foreach (Device device in this.Devices) {
device.KeyDown(key);
}
}
}
开发者ID:JakubVanek,项目名称:openBVE-1,代码行数:44,代码来源:Train.cs
示例20: GenerateMessage
private void GenerateMessage (VirtualKeys vkey, int scan, int key_code, XEventName type, int event_time)
{
bool state = (vkey == VirtualKeys.VK_NUMLOCK ? num_state : cap_state);
KeybdEventFlags up, down;
if (state) {
// The INTERMEDIARY state means : just after a 'press' event, if a 'release' event comes,
// don't treat it. It's from the same key press. Then the state goes to ON.
// And from there, a 'release' event will switch off the toggle key.
SetState (vkey, false);
} else {
down = (vkey == VirtualKeys.VK_NUMLOCK ? KeybdEventFlags.ExtendedKey : KeybdEventFlags.None);
up = (vkey == VirtualKeys.VK_NUMLOCK ? KeybdEventFlags.ExtendedKey :
KeybdEventFlags.None) | KeybdEventFlags.KeyUp;
if ((key_state_table [(int) vkey] & 0x1) != 0) { // it was on
if (type != XEventName.KeyPress) {
SendKeyboardInput (vkey, scan, key_code, down, event_time);
SendKeyboardInput (vkey, scan, key_code, up, event_time);
SetState (vkey, false);
key_state_table [(int) vkey] &= unchecked ((byte) ~0x01);
}
} else {
if (type == XEventName.KeyPress) {
SendKeyboardInput (vkey, scan, key_code, down, event_time);
SendKeyboardInput (vkey, scan, key_code, up, event_time);
SetState (vkey, true);
key_state_table [(int) vkey] |= 0x01;
}
}
}
}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:31,代码来源:X11Keyboard.cs
注:本文中的VirtualKeys类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论