当前位置: 首页>>代码示例>>C#>>正文


C# ModifierKeys.HasFlag方法代码示例

本文整理汇总了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;
        }
开发者ID:Kei-Nanigashi,项目名称:StarryEyes,代码行数:58,代码来源:HotKeyTextBox.cs

示例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;
 }
开发者ID:CascadesCarnivoreProject,项目名称:Timelapse,代码行数:13,代码来源:Utilities.cs

示例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;
     }
 }
开发者ID:UrsaLabs,项目名称:L2K,代码行数:21,代码来源:Shortcut.cs

示例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;
     }
 }
开发者ID:Nickakanickiam,项目名称:Terraria-Map-Editor,代码行数:21,代码来源:TilePicker.cs

示例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);
        }
开发者ID:r3peat,项目名称:D3Helper.Public,代码行数:16,代码来源:IS_Keyboard.cs

示例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;
        } 
开发者ID:r3peat,项目名称:D3Helper.Public,代码行数:13,代码来源:IS_Keyboard.cs

示例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;
 }
开发者ID:alexcmd,项目名称:CascadeTrainingTool,代码行数:15,代码来源:HotkeyManager.cs

示例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;
 }
开发者ID:Heliflyer,项目名称:helios,代码行数:9,代码来源:KeyboardEmulator.cs

示例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;
 }
开发者ID:c0a5tar,项目名称:Mystique,代码行数:16,代码来源:KeyAssignCore.cs

示例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();
        }
开发者ID:samuto,项目名称:designscript,代码行数:10,代码来源:GraphController.Helpers.cs

示例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;
        }
开发者ID:samuto,项目名称:designscript,代码行数:17,代码来源:EdgeController.cs


注:本文中的ModifierKeys.HasFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。