{
ModifierKeys keys = Keyboard.Modifiers;
if ((e.Key == Key.G) && keys == ModifierKeys.Control)
{
MessageBox.Show("你按下了Ctrl+G组合键!");
}
}
没有按下任何修饰符。
Alt 键已按下。
Ctrl 键已按下。
Shift 键已按下。
Windows 徽标键已按下。
Apple 键(也称作"Open Apple 键")已按下。
{
// Summary:
// Specifies the set of modifier keys.
[Flags]
public enum ModifierKeys
{
// Summary:
// No modifiers are pressed.
None = 0,
//
// Summary:
// The ALT key is pressed.
Alt = 1,
//
// Summary:
// The CTRL key is pressed.
Control = 2,
//
// Summary:
// The SHIFT key is pressed.
Shift = 4,
//
// Summary:
// The Windows logo key is pressed.
Windows = 8,
//
// Summary:
// The Apple key (also known as the "Open Apple key") is pressed.
Apple = 8,
}
}