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

C# Keys类代码示例

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

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



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

示例1: ProcessDialogKey

        protected override bool ProcessDialogKey(Keys keyData) {
            if (keyData == Keys.Escape) {
                SelectedIndex = originalSelectedIndex;
            }

            return base.ProcessDialogKey(keyData);
        }
开发者ID:cagatayalkan,项目名称:VersionOne.Client.VisualStudio,代码行数:7,代码来源:PropertyGridListBox.cs


示例2: ModuleProperty

        public ModuleProperty(MacroList p, MacroModule mod, Keys shortcut)
        {
            _parent = p;
            _prevShortCut = shortcut;
            _module = mod==null? new MacroModule(0) : (MacroModule)mod.Clone();
            //
            // Windows �t�H�[�� �f�U�C�i �T�|�[�g�ɕK�v�ł��B
            //
            InitializeComponent();

            this._titleLabel.Text = GApp.Strings.GetString("Form.ModuleProperty._titleLabel");
            this._pathLabel.Text = GApp.Strings.GetString("Form.ModuleProperty._pathLabel");
            this._additionalAssemblyLabel.Text = GApp.Strings.GetString("Form.ModuleProperty._additionalAssemblyLabel");
            this._shortcutLabel.Text = GApp.Strings.GetString("Form.ModuleProperty._shortcutLabel");
            this._debugOption.Text = GApp.Strings.GetString("Form.ModuleProperty._debugOption");
            this._okButton.Text = GApp.Strings.GetString("Common.OK");
            this._cancelButton.Text = GApp.Strings.GetString("Common.Cancel");
            this.Text = GApp.Strings.GetString("Form.ModuleProperty.Text");

            if(mod!=null) {
                _title.Text = _module.Title;
                _path.Text = _module.Path;
                _additionalAssembly.Text = Concat(_module.AdditionalAssemblies);
                _debugOption.Checked = _module.DebugMode;
                _shortcut.Key = shortcut;
            }
        }
开发者ID:rfyiamcool,项目名称:solrex,代码行数:27,代码来源:ModuleProperty.cs


示例3: Update

    public void Update(GameTime gameTime, Keys k, Keys p)
    {
        if (Playertype == 0)
        {
            KeyboardState currentKeyboardState = Keyboard.GetState();
            if (currentKeyboardState.IsKeyDown(k)) // getal geeft bewegingssnelheid aan. k is voor omlaag bewegen. 
            {
                Position.Y += 6;
            }

            else if (currentKeyboardState.IsKeyDown(p)) // getal geeft bewegingssnelheid aan. p is voor omhoog bewegen. 
            {
                Position.Y -= 6;
            }
        }
        else if (Playertype == 1)
        {
            for (int i = 0; i <= 5; i++)
            {
                if (this.MiddlePaddle > Pong.getGameState.PlayingBall.MiddleBall)
                {
                    Position.Y -= 1;
                }
                else if (this.MiddlePaddle < Pong.getGameState.PlayingBall.MiddleBall)
                {
                    Position.Y += 1;
                }
            }
        }
        BoundsPaddle.X = (int)Position.X;
        BoundsPaddle.Y = (int)Position.Y;
    }
开发者ID:Lunaface,项目名称:Pong,代码行数:32,代码来源:Paddle.cs


示例4: Convert

        public string Convert(Keys[] keys)
        {
            string output = "";
            bool usesShift = (keys.Contains(Keys.LeftShift) || keys.Contains(Keys.RightShift));

            foreach (Keys key in keys)
            {
                if (key >= Keys.A && key <= Keys.Z)
                    output += key.ToString();
                else if (key >= Keys.NumPad0 && key <= Keys.NumPad9)
                    output += ((int)(key - Keys.NumPad0)).ToString();
                else if (key >= Keys.D0 && key <= Keys.D9)
                {
                    string num = ((int)(key - Keys.D0)).ToString();
                    output += num;
                }
                else if(key == Keys.Space)
                {
                    output += " ";
                }
                else if(key == Keys.OemPeriod)
                {
                    output += ".";
                }

                if (!usesShift) output = output.ToLower();
            }
            return output;
        }
开发者ID:LuckiiGoggy,项目名称:COMP7051Assignment3,代码行数:29,代码来源:Console.cs


示例5: KeyboardCombo

 public KeyboardCombo(Keys key, bool alt, bool control, bool shift)
 {
     Key = key;
     Alt = alt;
     Control = control;
     Shift = shift;
 }
开发者ID:almx,项目名称:ExRep,代码行数:7,代码来源:KeyboardShortcutHandler.cs


示例6: Arrow

        public Arrow(Keys lastKey, object obj)
        {
            Image = new Image();
            switch (lastKey)
            {
                case Keys.W:
                    Image.Path = "Gameplay/Projectiles/arrow_up";
                    break;
                case Keys.S:
                    Image.Path = "Gameplay/Projectiles/arrow_down";
                    break;
                case Keys.A:
                    Image.Path = "Gameplay/Projectiles/arrow_left";
                    break;
                case Keys.D:
                    Image.Path = "Gameplay/Projectiles/arrow_right";
                    break;
            }

            DirectionKey = lastKey;

            if (obj.GetType() == typeof(Player))
            {
                Player p = (Player)obj;
                Image.Position = p.Image.Position;
            }
            MoveSpeed = 250f;
            Image.Scale = new Vector2(1, 2);
            Image.LoadContent();
        }
开发者ID:tmen13,项目名称:Avalon,代码行数:30,代码来源:Arrow.cs


示例7: ProcessCmdKey

 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if ((keyData == Keys.PageDown))
     {
         dataGridView1.ClearSelection();
         dataGridView4.ClearSelection();
         dataGridView4.Focus();
         dataGridView4.Rows[0].Selected = true;
         showDetail(dataGridView4.Rows[0].Cells[1].Value.ToString());
         return true;
     }
     else if (keyData == Keys.PageUp)
     {
         dataGridView1.ClearSelection();
         dataGridView4.ClearSelection();
         dataGridView1.Focus();
         dataGridView1.Rows[0].Selected = true;
         showDetail(dataGridView1.Rows[0].Cells[1].Value.ToString());
         return true;
     }
     else
     {
         return base.ProcessCmdKey(ref msg, keyData);
     }
 }
开发者ID:itktc,项目名称:projectktc-v2,代码行数:25,代码来源:MainSalePos.cs


示例8: KeyToString

        /// <summary>
        /// キー情報から文字を取得する
        /// </summary>
        /// <param name="key">押下されたキー</param>
        /// <param name="shitKeyPressed">シフトキーが押されていたか?</param>
        /// <param name="character">キー入力から変換された文字</param>
        /// <returns>文字取得が成功した場合trueを返す</returns>
        public static bool KeyToString(Keys key, bool shitKeyPressed,
                                                                    out char character)
        {
            bool result = false;
            character = ' ';
            CharPair charPair;

            if ((Keys.A <= key && key <= Keys.Z) || key == Keys.Space)
            {
                // A~Z、スペースキーはそのまま文字コードとして使用する
                character = (shitKeyPressed) ? (char)key : Char.ToLower((char)key);
                result = true;
            }
            else if (keyMap.TryGetValue(key, out charPair))
            {
                // それ以外の場合はKeyMapの情報を元に変換する
                if (!shitKeyPressed)
                {
                    character = charPair.NormalChar;
                    result = true;
                }
                else if (charPair.ShiftChar.HasValue)
                {
                    character = charPair.ShiftChar.Value;
                    result = true;
                }
            }

            return result;
        }
开发者ID:himapo,项目名称:ccm,代码行数:37,代码来源:KeyboardUtils.cs


示例9: IsKeyDown

 public static bool IsKeyDown(Keys key)
 {
     if (kbState.IsKeyDown(key))
         return true;
     else
         return false;
 }
开发者ID:Neckronis,项目名称:GameTemplate,代码行数:7,代码来源:InputManager.cs


示例10: Unregister

        public virtual Action<KeyboardState, GameTime> Unregister(Keys key)
        {
            Action<KeyboardState, GameTime> action = _keyboardInput[key];
            _keyboardInput.Remove(key);

            return action;
        }
开发者ID:hanjos,项目名称:gameoflife-xna,代码行数:7,代码来源:Input.cs


示例11: ProcessKeyPreview

        public static void ProcessKeyPreview(ref Message m, Keys ModifierKeys)
        {
            const int WM_KEYDOWN = 0x100;
            //const int WM_KEYUP = 0x101;
            const int WM_CHAR = 0x102;
            const int WM_SYSCHAR = 0x106;
            const int WM_SYSKEYDOWN = 0x104;
            //const int WM_SYSKEYUP = 0x105;
            const int WM_IME_CHAR = 0x286;

            KeyEventArgs e = null;

            if ((m.Msg != WM_CHAR) && (m.Msg != WM_SYSCHAR) && (m.Msg != WM_IME_CHAR))
            {
                e = new KeyEventArgs(((Keys)((int)((long)m.WParam))) | ModifierKeys);
                if ((m.Msg == WM_KEYDOWN) || (m.Msg == WM_SYSKEYDOWN))
                    control.TrappedKeyDown(e);

                // Remove any WM_CHAR type messages if supresskeypress is true.
                if (e.SuppressKeyPress)
                {
                    RemovePendingMessages(WM_CHAR, WM_CHAR);
                    RemovePendingMessages(WM_SYSCHAR, WM_SYSCHAR);
                    RemovePendingMessages(WM_IME_CHAR, WM_IME_CHAR);
                }
            }
        }
开发者ID:MikhailoMMX,项目名称:AspectMarkup,代码行数:27,代码来源:KeyboardShortcutHelper.cs


示例12: Update

        public void Update(GameTime time)
        {
            oldState = currentState;
            currentState = Microsoft.Xna.Framework.Input.Keyboard.GetState();
            shiftDown = currentState.IsKeyDown(Keys.LeftShift) || currentState.IsKeyDown(Keys.RightShift);

            currentlyPressed = currentState.GetPressedKeys();
            previouslyPressed = oldState.GetPressedKeys();

            if (currentlyPressed.Length != previouslyPressed.Length)
            {
                keyHoldTimer = 0.0f;
                keyHeld = false;
                lastKeyHeld = FindLastKeyPressed();
            }

            if (!keyHeld && currentlyPressed.Length > 0)
            {
                keyHoldTimer += (float)time.ElapsedGameTime.TotalMilliseconds;
                if (keyHoldTimer > keyHoldWait)
                {
                    keyHeld = true;
                }
            }
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:25,代码来源:UIKeyboard.cs


示例13: ProcessCmdKey

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData.HasFlag(Keys.Control))
            {
                if (keyData.HasFlag(Keys.O))
                {
                    OpenMenuItem.PerformClick();
                    return true;
                }
                if (keyData.HasFlag(Keys.Alt) && keyData.HasFlag(Keys.Shift) && keyData.HasFlag(Keys.S))
                {
                    SaveDecryptedMenuItem.PerformClick();
                    return true;
                }
                if (keyData.HasFlag(Keys.Shift) && keyData.HasFlag(Keys.S))
                {
                    SaveEncryptedMenuItem.PerformClick();
                    return true;
                }
                if (keyData.HasFlag(Keys.S))
                {
                    SaveMenuItem.PerformClick();
                    return true;
                }
            }

            return m_tabPages.Any(tabPage => tabPage.OnHotkey(keyData)) || base.ProcessCmdKey(ref msg, keyData);
        }
开发者ID:ttgowings,项目名称:NFirmwareEditor,代码行数:28,代码来源:MainWindow.cs


示例14: Wait

            /// <summary>
            /// Wait until the key gets pressed.
            /// </summary>
            /// <param name="k"></param>
            public void Wait(Keys k)
            {
                if (k == Keys.None)
                    throw new ArgumentException("Must submit valid Key definition!");
                _endKey = k;

                if (this.TimeOutVal.HasValue)
                {
                    _timeoutTimer = new System.Threading.Timer(new System.Threading.TimerCallback(OnTimoutTick));
                    _timeoutTimer.Change(this.TimeOutVal.Value, Timeout.Infinite);
                }
                _keyboardHook.IAKeyEvent += OnKeyEvent;

                while (true)
                {
                    lock (abortLock)
                    {
                        if (abort)
                            break;
                    }
                    Application.DoEvents(); // This is necessary if the Wait Method gets called on the Main GUI Thread
                    Thread.Sleep(2);
                }
                _keyboardHook.IAKeyEvent -= OnKeyEvent;
            }
开发者ID:Tyelpion,项目名称:IronAHK,代码行数:29,代码来源:KeyWaitCommand.cs


示例15: LoadFromJson

 public void LoadFromJson(JObject jsonData)
 {
     string tempTriggerKey = (string)jsonData["trigger key"];         // Load String from json
     VirtualKeyCode vkCode = KeyTranslater.GetKeyCode(tempTriggerKey); // Convert the string to a keycode using the Keytranslator
     triggerKey = (Keys)vkCode;                                        // Cast the Vkeycode to a key and save to the class
     commandWord = (string)jsonData["command word"];
 }
开发者ID:AlexanderMcNeill,项目名称:voxvisio,代码行数:7,代码来源:KeyPressCommand.cs


示例16: FromKeys

        public static KeyboardShortcut FromKeys(Keys keys)
        {
            KeyboardShortcut ks = new KeyboardShortcut();

            // check for modifers and remove from val
            if (IsSet(keys, Keys.Control))
            {
                ks.Modifiers |= Keys.Control;
                keys ^= Keys.Control;
            }
            if (IsSet(keys, Keys.Alt))
            {
                ks.Modifiers |= Keys.Alt;
                keys ^= Keys.Alt;
            }
            if (IsSet(keys, Keys.Shift))
            {
                ks.Modifiers |= Keys.Shift;
                keys ^= Keys.Shift;
            }

            // remaining should be the key
            ks.Key = keys;

            return ks;
        }
开发者ID:kleopatra999,项目名称:SuperPutty-1,代码行数:26,代码来源:KeyboardShortcut.cs


示例17: ProcessCmdKey

 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == Keys.Enter)
     {
         if (!(this.current_focused_control is Button))
         {
             if (this.current_focused_control.Name == this.mskNewSernum.Name)
             {
                 if (ValidateSN.Check(this.mskNewSernum.Text))
                 {
                     SendKeys.Send("{TAB}");
                     return true;
                 }
             }
             else
             {
                 SendKeys.Send("{TAB}");
                 return true;
             }
         }
     }
     if (keyData == Keys.Escape)
     {
         this.DialogResult = DialogResult.Cancel;
         this.Close();
         return true;
     }
     return base.ProcessCmdKey(ref msg, keyData);
 }
开发者ID:wee2tee,项目名称:SN_Net,代码行数:29,代码来源:LostRenewForm.cs


示例18: ProcessCmdKey

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if ((keyData & Keys.F5) == Keys.F5)
                this.TriggerCompileButtonClicked();

            return base.ProcessCmdKey(ref msg, keyData);
        }
开发者ID:smack0007,项目名称:TurtleSharp,代码行数:7,代码来源:MainForm.cs


示例19: GetShortcutString

        /// <summary>
        /// Gets the human readable representation of the given keys.
        /// </summary>
        /// <param name="keys">Pressed keys</param>
        /// <returns>Keys separated by plus sign</returns>
        public static string GetShortcutString(Keys keys)
        {
            if (keys == Keys.None)
            {
                return string.Empty;
            }

            List<string> singleKeys = new List<string>();

            if ((keys & Keys.Control) == Keys.Control)
            {
                singleKeys.Add("Control");
                keys = keys ^ Keys.Control;
            }
            if ((keys & Keys.Alt) == Keys.Alt)
            {
                singleKeys.Add("Alt");
                keys = keys ^ Keys.Alt;
            }
            if ((keys & Keys.Shift) == Keys.Shift)
            {
                singleKeys.Add("Shift");
                keys = keys ^ Keys.Shift;
            }

            foreach (Keys key in EndKeys)
            {
                if (keys == key)
                {
                    singleKeys.Add(new KeysConverter().ConvertTo(key, typeof(string)) as string);
                }
            }

            return String.Join("+", singleKeys.ToArray());
        }
开发者ID:RyanGrange,项目名称:Ketarin,代码行数:40,代码来源:Hotkey.cs


示例20: SetCharacter

        /// <summary>
        /// Sets the char value for the specified key and key modifier combination
        /// </summary>
        /// <param name="key">The key for which to set the corresponding char value</param>
        /// <param name="mod">The key modifier for which to set the corresponding char value</param>
        /// <param name="ch">The char value to set for the specified key and key modifier</param>
        public static void SetCharacter(Keys key, KeyModifier mod, char ch)
        {
            if (!mMap.ContainsKey(key))
                mMap.Add(key, new Dictionary<KeyModifier, char>());

            mMap[key][mod] = ch;
        }
开发者ID:schminitz,项目名称:IceCreamXNA,代码行数:13,代码来源:ConsoleKeyMap.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Keyword类代码示例发布时间:2022-05-24
下一篇:
C# Keyframe类代码示例发布时间: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