本文整理汇总了C#中ModifierKeys.HasFlag方法的典型用法代码示例。如果您正苦于以下问题:C# ModifierKeys.HasFlag方法的具体用法?C# ModifierKeys.HasFlag怎么用?C# ModifierKeys.HasFlag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModifierKeys
的用法示例。
在下文中一共展示了ModifierKeys.HasFlag方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StringifyShortcutKeys
public static string StringifyShortcutKeys(Key key, ModifierKeys modifier)
{
var content = String.Empty;
if (modifier.HasFlag(ModifierKeys.Control))
{
content += "Ctrl-";
}
if (modifier.HasFlag(ModifierKeys.Shift))
{
content += "Shift-";
}
if (modifier.HasFlag(ModifierKeys.Alt))
{
content += "Alt-";
}
switch (key)
{
case Key.D0:
case Key.D1:
case Key.D2:
case Key.D3:
case Key.D4:
case Key.D5:
case Key.D6:
case Key.D7:
case Key.D8:
case Key.D9:
content += key.ToString().Substring(1);
break;
case Key.NumPad0:
case Key.NumPad1:
case Key.NumPad2:
case Key.NumPad3:
case Key.NumPad4:
case Key.NumPad5:
case Key.NumPad6:
case Key.NumPad7:
case Key.NumPad8:
case Key.NumPad9:
content += key.ToString().Substring(6);
break;
case Key.LeftAlt:
case Key.RightAlt:
case Key.LeftCtrl:
case Key.RightCtrl:
case Key.LeftShift:
case Key.RightShift:
// ignore control keys
break;
default:
content += key.ToString();
break;
}
return content;
}
示例2: GetIncrement
public static int GetIncrement(bool forward, ModifierKeys modifiers)
{
int increment = forward ? 1 : -1;
if (modifiers.HasFlag(ModifierKeys.Shift))
{
increment *= 5;
}
if (modifiers.HasFlag(ModifierKeys.Control))
{
increment *= 10;
}
return increment;
}
示例3: Shortcut
public Shortcut(Key key, ModifierKeys modifiers, bool toggles, int group)
{
AssignedKey = key.ToString();
isToggle = toggles;
belongsToGroup = group;
if (modifiers != ModifierKeys.None) {
hasMods = true;
modsList = new List<string>();
if (modifiers.HasFlag(ModifierKeys.Control)) {
modsList.Add("Ctrl");
}
if (modifiers.HasFlag(ModifierKeys.Alt)) {
modsList.Add("Alt");
}
if (modifiers.HasFlag(ModifierKeys.Shift)) {
modsList.Add("Shift");
}
} else {
hasMods = false;
}
}
示例4: Swap
public void Swap(ModifierKeys modifier)
{
switch (PaintMode)
{
case PaintMode.Tile:
SwapTile();
break;
case PaintMode.Wall:
SwapWall();
break;
case PaintMode.TileAndWall:
if (modifier.HasFlag(ModifierKeys.Shift))
SwapWall();
else
SwapTile();
break;
case PaintMode.Liquid:
SwapLiquid();
break;
}
}
示例5: ReleaseModKey
private static void ReleaseModKey(ModifierKeys ModKey)
{
if (ModKey == ModifierKeys.None)
return;
//-- log action
A_Handler.Log.LogEntry.addLogEntry("Released ModKey(" + ModKey + ")");
//
if (ModKey.HasFlag(ModifierKeys.Alt))
WindowsInput.InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
if (ModKey.HasFlag(ModifierKeys.Shift))
WindowsInput.InputSimulator.SimulateKeyUp(VirtualKeyCode.SHIFT);
if (ModKey.HasFlag(ModifierKeys.Ctrl))
WindowsInput.InputSimulator.SimulateKeyUp(VirtualKeyCode.CONTROL);
}
示例6: getVirtualKeyCodes_byModkey
private static List<VirtualKeyCode> getVirtualKeyCodes_byModkey(ModifierKeys modkey)
{
List<VirtualKeyCode> Buffer = new List<VirtualKeyCode>();
if (modkey.HasFlag(ModifierKeys.Alt))
Buffer.Add(VirtualKeyCode.LMENU);
if (modkey.HasFlag(ModifierKeys.Shift))
Buffer.Add(VirtualKeyCode.LSHIFT);
if (modkey.HasFlag(ModifierKeys.Ctrl))
Buffer.Add(VirtualKeyCode.LCONTROL);
return Buffer;
}
示例7: GetFlags
private static HotkeyFlags GetFlags(ModifierKeys modifiers, bool noRepeat)
{
var flags = HotkeyFlags.None;
if (modifiers.HasFlag(ModifierKeys.Shift))
flags |= HotkeyFlags.Shift;
if (modifiers.HasFlag(ModifierKeys.Control))
flags |= HotkeyFlags.Control;
if (modifiers.HasFlag(ModifierKeys.Alt))
flags |= HotkeyFlags.Alt;
if (modifiers.HasFlag(ModifierKeys.Windows))
flags |= HotkeyFlags.Windows;
if (noRepeat)
flags |= HotkeyFlags.NoRepeat;
return flags;
}
示例8: ModifierKeysToString
public static string ModifierKeysToString(ModifierKeys modifiers)
{
string ret = "";
if (modifiers.HasFlag(ModifierKeys.Shift)) ret += "SHIFT + ";
if (modifiers.HasFlag(ModifierKeys.Control)) ret += "CONTROL + ";
if (modifiers.HasFlag(ModifierKeys.Alt)) ret += "ALT + ";
if (modifiers.HasFlag(ModifierKeys.Windows)) ret += "WINDOWS + ";
return ret;
}
示例9: KeyToString
/// <summary>
/// キー表現を判別可能な文字列に変換します。
/// </summary>
public static String KeyToString(ModifierKeys modkeys, Key key)
{
String ret = key.ToString();
if (modkeys.HasFlag(ModifierKeys.Shift))
ret = "Shift+" + ret;
if (modkeys.HasFlag(ModifierKeys.Windows))
ret = "Win+" + ret;
if (modkeys.HasFlag(ModifierKeys.Alt))
ret = "Alt+" + ret;
if (modkeys.HasFlag(ModifierKeys.Control))
ret = "Control+" + ret;
return ret;
}
示例10: BeginDragSelectionRegion
private void BeginDragSelectionRegion(ModifierKeys modifiers)
{
if (!modifiers.HasFlag(ModifierKeys.Control) && !modifiers.HasFlag(ModifierKeys.Shift))
ClearSelectionInternal();
currentDragState = DragState.RegionSelection;
if (visualHost != null)
this.visualHost.BeginDragSelection();
}
示例11: SelectComponent
internal bool SelectComponent(uint componentId, ModifierKeys modifiers)
{
selectedEdge = null;
edgeCollection.TryGetValue(componentId, out selectedEdge);
if (selectedEdge != null)
{
if (modifiers.HasFlag(ModifierKeys.Control))
selectedEdge.Selected = !selectedEdge.Selected;
else
selectedEdge.Selected = true;
selectedEdge.Compose();
}
return true;
}