• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ModifierKeys类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ModifierKeys的典型用法代码示例。如果您正苦于以下问题:C# ModifierKeys类的具体用法?C# ModifierKeys怎么用?C# ModifierKeys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ModifierKeys类属于命名空间,在下文中一共展示了ModifierKeys类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: KeyAssign

 public KeyAssign(Key key, ModifierKeys modifiers, IEnumerable<KeyAssignActionDescription> actions, bool handlePreview = false)
 {
     Key = key;
     Modifiers = modifiers;
     HandlePreview = handlePreview;
     Actions = actions.ToArray();
 }
开发者ID:hosiminn,项目名称:StarryEyes,代码行数:7,代码来源:KeyAssign.cs


示例2: AddKeyBinding

        public void AddKeyBinding(ICommand command, object param, Key key, ModifierKeys modifierKeys = ModifierKeys.None)
        {
            Contract.Requires(command != null);

            var binding = new KeyBinding(key, modifierKeys);
            m_keyBindings.Add(binding, new CommandParamPair(command, param));
        }
开发者ID:hungdluit,项目名称:bot,代码行数:7,代码来源:CommandKeyMapper.cs


示例3: OnLoading

 protected override void OnLoading()
 {
   base.OnLoading();
   var element = Controller.Element;
   _modifiersKeys = MouseWheel.GetVScrollModifiers(element);
   MouseWheel.VScrollModifiersProperty.AddValueChanged(element, OnModifierKeysYChanged);
 }
开发者ID:heartszhang,项目名称:WeiZhi3,代码行数:7,代码来源:MouseWheelFlowDocumentPageViewerScrollClient.cs


示例4: HotKey

 public HotKey(int id, Key key, ModifierKeys modifiers)
 {
     this.id = id;
     this.key = key;
     this.modifiers = modifiers;
     this.actions = new List<Action>();
 }
开发者ID:stufkan,项目名称:SimpleAudio,代码行数:7,代码来源:HotKey.cs


示例5: HookHotKey

        public static void HookHotKey(Window window, Key key,
            ModifierKeys modifiers, int keyId, EventHandler hookHandler)
        {

            HwndSourceHook hook = delegate(IntPtr hwnd, int msg, IntPtr wParam,
                IntPtr lParam, ref bool handled)
            {

                if (msg == HotKeyHelper.WM_HOTKEY)
                {
                    // TODO: parse out the lParam to see if it is actually the one registered
                    // see http://msdn.microsoft.com/en-us/library/ms646279(VS.85).aspx

                    hookHandler(window, EventArgs.Empty);
                    handled = true;
                }
                return IntPtr.Zero;
            };

            HwndSource source = PresentationSource.FromVisual(window) as HwndSource;
            if (source == null)
            {
                throw new ApplicationException("window doesn't have a source yet. Did you wait till after the SourceInitialized event?");
            }
            source.AddHook(hook);

            RegisterHotKey(window, key, modifiers, keyId);
        }
开发者ID:x-skywalker,项目名称:Tasks.Show,代码行数:28,代码来源:HotKeyHelper.cs


示例6: RegisterHotKey

 /// <summary>
 /// Регистрация хоткея в системе
 /// </summary>
 /// <param name="modifier">Модификатор хоткея.</param>
 /// <param name="key">Клавиша хоткея.</param>
 public void RegisterHotKey(ModifierKeys modifier, Keys key)
 {
     _currentId = _currentId + 1;
     if (!NativeMethods.RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key)) {
         throw new InvalidOperationException("Couldn’t register the hot key.");
     }
 }
开发者ID:GoldRenard,项目名称:DMOAdvancedLauncher,代码行数:12,代码来源:HotkeyHook.cs


示例7: Select

 public void Select(ModifierKeys modifierKey, ICollection<ITreeItem> rootTreeItems, ITreeItem newSelectedItem, ITreeItem oldSelectedItem)
 {
     switch (modifierKey)
     {
         case ModifierKeys.Shift:
             if(_previousSelectionWasShift)
             {
                 _rangeSelector.Select(rootTreeItems, newSelectedItem, _previousShiftSelection);
             }
             else
             {
                 _rangeSelector.Select(rootTreeItems, newSelectedItem, oldSelectedItem);
                 _previousShiftSelection = oldSelectedItem;
             }
             _previousSelectionWasShift = true;
             break;
         case ModifierKeys.Control:
             _previousSelectionWasShift = false;
             _inverseSelector.Select(rootTreeItems, newSelectedItem);
             break;
         default:
             _previousSelectionWasShift = false;
             _nullSelector.Select(rootTreeItems, newSelectedItem);
             break;
     }
 }
开发者ID:e82eric,项目名称:Prompts,代码行数:26,代码来源:MultiSelector.cs


示例8: TryGetKeyInput

        /// <summary>
        /// Try and get the KeyInput which corresponds to the given Key and modifiers
        /// TODO: really think about this method
        /// </summary>
        internal bool TryGetKeyInput(Key key, ModifierKeys modifierKeys, out KeyInput keyInput)
        {
            // First just check and see if there is a direct mapping
            var keyType = new KeyType(key, modifierKeys);
            if (_cache.TryGetValue(keyType, out keyInput))
            {
                return true;
            }

            // Next consider only the shift key part of the requested modifier.  We can
            // re-apply the original modifiers later
            keyType = new KeyType(key, modifierKeys & ModifierKeys.Shift);
            if (_cache.TryGetValue(keyType, out keyInput))
            {
                // Reapply the modifiers
                keyInput = KeyInputUtil.ChangeKeyModifiers(keyInput, ConvertToKeyModifiers(modifierKeys));
                return true;
            }

            // Last consider it without any modifiers and reapply
            keyType = new KeyType(key, ModifierKeys.None);
            if (_cache.TryGetValue(keyType, out keyInput))
            {
                // Reapply the modifiers
                keyInput = KeyInputUtil.ChangeKeyModifiers(keyInput, ConvertToKeyModifiers(modifierKeys));
                return true;
            }

            return false;
        }
开发者ID:praveennet,项目名称:VsVim,代码行数:34,代码来源:KeyboardMap.cs


示例9: Match

        /// <summary>
        /// Determines whether the event arguments match the specified key combination.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="modifierKeys">The modifier keys.</param>
        /// <returns>True if the event arguments match the specified key combination, otherwise false.</returns>
        public bool Match(Key key, ModifierKeys modifierKeys = ModifierKeys.None)
        {
            if (this.Key == key)
            {
                if (key == Keyboard.LeftControl || key == Keyboard.RightControl)
                {
                    return (this.ModifierKeys | ModifierKeys.Control) == (modifierKeys | ModifierKeys.Control);
                }

                if (key == Keyboard.LeftAlt || key == Keyboard.RightAlt)
                {
                    return (this.ModifierKeys | ModifierKeys.Alt) == (modifierKeys | ModifierKeys.Alt);
                }

                if (key == Keyboard.LeftShift || key == Keyboard.RightShift)
                {
                    return (this.ModifierKeys | ModifierKeys.Shift) == (modifierKeys | ModifierKeys.Shift);
                }

                if (key == Keyboard.LeftWindows || key == Keyboard.RightWindows)
                {
                    return (this.ModifierKeys | ModifierKeys.Windows) == (modifierKeys | ModifierKeys.Windows);
                }

                return this.ModifierKeys == modifierKeys;
            }

            return false;
        }
开发者ID:vetuomia,项目名称:rocket,代码行数:35,代码来源:KeyEventArgs.cs


示例10: KeyDescriptor

		KeyDescriptor (SpecialKey specialKey, char keyChar, ModifierKeys modifierKeys, object nativeKeyChar)
		{
			SpecialKey = specialKey;
			KeyChar = keyChar;
			ModifierKeys = modifierKeys;
			NativeKeyChar = nativeKeyChar;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:KeyDescriptor.cs


示例11: RegisterHotKey

        public int RegisterHotKey(ModifierKeys mods, Keys key)
        {
            if (!RegisterHotKey(_window.Handle, ++_currentId, (uint) mods, (uint) key))
                throw new Exception("Key register failed");

            return _currentId;
        }
开发者ID:aevv,项目名称:qcmd,代码行数:7,代码来源:KeyboardHook.cs


示例12: SaveKeys

 public void SaveKeys(ModifierKeys[] modifiers, Key key, ref String to)
 {
     String s = "";
     modifiers.ToList().ForEach(k => s += k.ToString() + "+");
     s += key.ToString();
     to = s;
 }
开发者ID:ondryaso,项目名称:j2-client,代码行数:7,代码来源:SettingsKeyInterpreter.cs


示例13: ConvertFromString

        public static Tuple<Keys, ModifierKeys> ConvertFromString(string keysString)
        {
            Keys mainKey = new Keys();
            ModifierKeys modKeys = new ModifierKeys();

            var keys = keysString.Split('+');
            foreach (string keyString in keys)
            {
                Keys key = (Keys)(new KeysConverter()).ConvertFromString(keyString);
                if (key == Keys.Alt || key == Keys.LWin || key == Keys.Shift || key == Keys.Control)
                {
                    switch (key)
                    {
                        case Keys.Alt: modKeys = modKeys | ModifierKeys.Alt; break;
                        case Keys.LWin: modKeys = modKeys | ModifierKeys.Win; break;
                        case Keys.Shift: modKeys = modKeys | ModifierKeys.Shift; break;
                        case Keys.Control: modKeys = modKeys | ModifierKeys.Control; break;
                    }
                }
                else
                {
                    mainKey = key;
                }
            }
            return new Tuple<Keys, ModifierKeys>(mainKey, (ModifierKeys)modKeys);
        }
开发者ID:ResQue1980,项目名称:ShiftLoL,代码行数:26,代码来源:Program.cs


示例14: PanicKey_PreviewKeyDown

        void PanicKey_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = true;

            var rKey = e.Key;
            switch (rKey)
            {
                case Key.LWin:
                case Key.RWin:
                case Key.NumLock:
                case Key.LeftShift:
                case Key.RightShift:
                case Key.LeftCtrl:
                case Key.RightCtrl:
                case Key.LeftAlt:
                case Key.RightAlt:
                    return;
            }

            if (r_OldKey == rKey && r_OldModifierKeys == Keyboard.Modifiers)
                return;

            r_OldKey = rKey;
            r_OldModifierKeys = Keyboard.Modifiers;

            Preference.Instance.Other.PanicKey.UpdateKey((int)Keyboard.Modifiers, KeyInterop.VirtualKeyFromKey(rKey));
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:27,代码来源:Other.xaml.cs


示例15: VertexSelectedEventArgs

 public VertexSelectedEventArgs(VertexControl vc, MouseButtonEventArgs e, ModifierKeys keys)
     : base()
 {
     VertexControl = vc;
     MouseArgs = e;
     Modifiers = keys;
 }
开发者ID:KevinCathcart,项目名称:GraphX,代码行数:7,代码来源:VertexSelectedEventArgs.cs


示例16: KeyEventArgs

		/// <summary>
		/// Initializes a new instance of the <see cref="Xwt.KeyEventArgs"/> class.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <param name="modifiers">The modifier keys.</param>
		/// <param name="isRepeat">the key has been pressed more then once.</param>
		/// <param name="timestamp">The timestamp of the key event.</param>
		public KeyEventArgs (Key key, ModifierKeys modifiers, bool isRepeat, long timestamp)
		{
			this.Key = key;
			this.Modifiers = modifiers;
			this.IsRepeat = isRepeat;
			this.Timestamp = timestamp;
		}
开发者ID:m13253,项目名称:xwt,代码行数:14,代码来源:KeyEventArgs.cs


示例17: ConvertToKeyInput

        public static KeyInput ConvertToKeyInput(Key key, ModifierKeys modifierKeys)
        {
            var modKeys = ConvertToKeyModifiers(modifierKeys);
            var tuple = TryConvertToKeyInput(key);
            if (tuple == null)
            {
                return new KeyInput(Char.MinValue, modKeys);
            }

            if ((modKeys & KeyModifiers.Shift) == 0)
            {
                var temp = tuple.Item1;
                return new KeyInput(temp.Char, temp.Key, modKeys);
            }

            // The shift flag is tricky.  There is no good API available to translate a virtualKey
            // with an additional modifier.  Instead we define the core set of keys we care about,
            // map them to a virtualKey + ModifierKeys tuple.  We then consult this map here to see
            // if we can appropriately "shift" the KeyInput value
            //
            // This feels like a very hackish solution and I'm actively seeking a better, more thorough
            // one

            var ki = tuple.Item1;
            var virtualKey = tuple.Item2;
            var found = MappedCoreChars.FirstOrDefault(x => x.Item2 == virtualKey && KeyModifiers.Shift == x.Item3);
            if (found == null)
            {
                return new KeyInput(ki.Char, modKeys);
            }
            else
            {
                return new KeyInput(found.Item1, modKeys);
            }
        }
开发者ID:ameent,项目名称:VsVim,代码行数:35,代码来源:KeyUtil.cs


示例18: KeyPushed

        public void KeyPushed(string key, ModifierKeys mod)
        {
            if (key == "space")
            {
                InputLine += " ";
            }
            else if (key == "return")
            {
                SendMessage();
            }
            else if (key == "backspace")
            {
                InputLine = InputLine.Remove(InputLine.Length - 1);
            }
            else if (key == "tab")
            {
                InputLine += "    ";
                Console.WriteLine(InputLine);
            }
            // Avoid unhandled special caracters 
            else if (key.Length == 1)
            {
                if (mod == ModifierKeys.Caps || mod == ModifierKeys.ShiftKeys)
                    key.ToUpper();

                InputLine += key;
            }
        }
开发者ID:TerenceWallace,项目名称:bloodbox,代码行数:28,代码来源:BBConsole.cs


示例19: RegisterHotkey

 public void RegisterHotkey(ModifierKeys keyModifier, Keys hotkey)
 {
     HotkeySettings.Default.ModifierKey = keyModifier;
     HotkeySettings.Default.Key = hotkey;
     HotkeySettings.Default.Save();
     Register();
 }
开发者ID:2moveit,项目名称:HotkeyKanban,代码行数:7,代码来源:HotkeyManager.cs


示例20: OnRunHotKeyPressed

 private void OnRunHotKeyPressed(Key key, ModifierKeys modifier)
 {
     if (state.IsConfigurationOpened)
         navigator.OpenConfiguration();
     else
         navigator.OpenMain();
 }
开发者ID:neptuo,项目名称:Productivity.SolutionRunner,代码行数:7,代码来源:DefaultRunHotKeyService.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ModifierList类代码示例发布时间:2022-05-24
下一篇:
C# ModifierEnum类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap