/// <summary> /// 同步按键对,像 LShiftKey(左shift键) 和 RShiftKey(右shift键)。 /// </summary> void SyncKeyPairs(KeyButton btn) { if (btn == keyButtonLShift) { keyButtonRShift.IsPressed = keyButtonLShift.IsPressed; } if (btn == keyButtonRShift) { keyButtonLShift.IsPressed = keyButtonRShift.IsPressed; } if (btn == keyButtonLAlt) { keyButtonRAlt.IsPressed = keyButtonLAlt.IsPressed; } if (btn == keyButtonRAlt) { keyButtonLAlt.IsPressed = keyButtonRAlt.IsPressed; } if (btn == keyButtonLControl) { keyButtonRControl.IsPressed = keyButtonLControl.IsPressed; } if (btn == keyButtonRControl) { keyButtonLControl.IsPressed = keyButtonRControl.IsPressed; } }
/// <summary> /// 处理特殊按键,例如 “AppsKey”。 /// </summary> bool ProcessSpecialKey(KeyButton btn) { bool handled = true; switch (btn.Key) { // 使用 “Shift+F10” 模拟 Apps 键。 case Keys.Apps: UserInteraction.KeyboardInput.SendKey( new int[] { (int)Keys.ShiftKey }, (int)Keys.F10); break; default: handled = false; break; } return handled; }