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


C# Keys.Equals方法代码示例

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


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

示例1: SendKey

 public void SendKey(int keyValue, Keys modifiers)
 {
     VirtualKeyCode key;
     if (modifiers.Equals(Keys.None))
     {
         if (Enum.TryParse(VkKeyScan(((char)keyValue)).ToString(), out key))
         {
             InputSimulator.SimulateKeyDown(key);
             InputSimulator.SimulateKeyUp(key);
         }
     }
     else if (modifiers.Equals(Keys.Shift) && keyValue >= (int)Keys.A && keyValue <= (int)Keys.Z)
     {
         if (Enum.TryParse(VkKeyScan(((char)keyValue)).ToString(), out key))
         {
             InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.SHIFT, key);
         }
     }
     else if (modifiers.Equals(Keys.Control) && keyValue >= (int)Keys.A && keyValue <= (int)Keys.Z)
     {
         if (Enum.TryParse(VkKeyScan(((char)keyValue)).ToString(), out key))
         {
             InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, key);
         }
     }
     else if (modifiers.Equals(Keys.Alt) && keyValue >= (int)Keys.A && keyValue <= (int)Keys.Z)
     {
         if (Enum.TryParse(VkKeyScan(((char)keyValue)).ToString(), out key))
         {
             //Alt is named MENU for legacy purposes.
             InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.MENU, key);
         }
     }
 }
开发者ID:rhpa23,项目名称:ShortcutStartMacro,代码行数:34,代码来源:Form1.cs

示例2: ProcessCmdKey

 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     // http://support.microsoft.com/kb/320584
     const int WM_KEYDOWN = 0x100;
     if (msg.Msg == WM_KEYDOWN)
     {
         if (keyData.Equals(Keys.Control | Keys.A))
         {
             base.SelectAll();
             return true;
         }
         if (keyData.Equals(Keys.Control | Keys.Back))
         {
             if (SelectionStart - 1 < 0)
                 return true;
             int min = Math.Min(SelectionStart, Text.Length - 1);
             int lastSpace = Text.LastIndexOf(' ', min, min);
             if (lastSpace == -1) // we delete all except symbols after selection
             {
                 Text = Text.Substring(SelectionStart);
                 return true;
             }
             string start =  Text.Substring(0, lastSpace);
             string end = Text.Substring(Math.Min(SelectionStart, Text.Length));
             Text = start + end;
             base.Select(lastSpace, 0);
             return true;
         }
     }
     return base.ProcessCmdKey(ref msg, keyData);
 }
开发者ID:povilaspanavas,项目名称:minder,代码行数:31,代码来源:MTextBox.cs

示例3: ProcessCmdKey

        // 입력(F12) 단축키 설정
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (!base.ProcessCmdKey(ref msg, keyData)) // 위에서 처리 안했으면
            {

                if (keyData.Equals(Keys.F12))
                {
                    button1.PerformClick();
                    return true;
                }
                if (keyData.Equals(Keys.Escape))
                {
                    button2.PerformClick();
                    return true;
                }
                if (keyData.Equals(Keys.F1))
                {
                    button3.PerformClick();
                    return true;
                }
                if (keyData.Equals(Keys.F9))
                {
                    button4.PerformClick();
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return true;
            }
        }
开发者ID:linuxbank,项目名称:PLOCR,代码行数:36,代码来源:DataEdit.cs

示例4: IsInputKey

	   protected override bool IsInputKey(Keys keyData) {
		  if (keyData.Equals(Keys.Down) && showSplit) {
			 return true;
		  } else {
			 return base.IsInputKey(keyData);
		  }
	   }
开发者ID:nithinphilips,项目名称:SMOz,代码行数:7,代码来源:SplitButton.cs

示例5: IsAcceptedKey

        /// <summary>
        /// Determines whether [is accepted key] [the specified key].
        /// </summary>
        /// <param name="key">The key to check.</param>
        /// <returns>If the key is accepted.</returns>
        public bool IsAcceptedKey(Keys key)
        {
            foreach (var acceptedKey in this.acceptedKeys)
            {
                if (key.Equals(acceptedKey))
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:xxy1991,项目名称:cozy,代码行数:17,代码来源:KeyFilter.cs

示例6: keyPress

        /// <summary>
        /// Upon keypress, all players connected to this stream will be notified that a key is pressed. 
        /// </summary>
        public void keyPress(Keys key)
        {
            Command command = Command.Unknown;
            if (key.Equals(SkillAKey))
            {
                command = Command.SkillAKeyDown;
                Key_A = true;
            }
            else if (key.Equals(SkillBKey))
            {
                command = Command.SkillBKeyDown;
                Key_B = true;
            }
            else if (key.Equals(SkillCKey))
            {
                command = Command.SkillCKeyDown;
                Key_C = true;
            }
            else if (key.Equals(SkillDKey))
            {
                command = Command.SkillDKeyDown;
                Key_D = true;
            }
            else if (key.Equals(MoveDownKey))
            {
                command = Command.MoveDownKeyDown;
                Key_DOWN = true;
            }
            else if (key.Equals(MoveLeftKey))
            {
                command = Command.MoveLeftKeyDown;
                Key_LEFT = true;
            }
            else if (key.Equals(MoveRightKey))
            {
                command = Command.MoveRightKeyDown;
                Key_RIGHT = true;
            }
            else if (key.Equals(MoveUpKey))
            {
                command = Command.MoveUpKeyDown;
                Key_UP = true;
            }

            foreach (Controller player in connectedPlayers)
            {
                player.command(command);
            }
        }
开发者ID:gsdmlgla,项目名称:Project,代码行数:52,代码来源:KeyCommandStream.cs

示例7: Kh_KeyUp

 private void Kh_KeyUp(Keys key, bool Shift, bool Ctrl, bool Alt)
 {
     if (key.Equals(Keys.NumLock))
     {
         if(numLockState)
         {
             numpadGroup.Brush = new SolidColorBrush(Color.Black);
             keyboard.Update();
         }
         else
         {
             numpadGroup.Brush = new SolidColorBrush(selectedColor);
             keyboard.Update();
         }
         numLockState = !numLockState;
     }
 }
开发者ID:Hornwall,项目名称:corsair-num-lock-status,代码行数:17,代码来源:Form1.cs

示例8: ProcessCmdKey

 /**Author: NGUYEN TUAN
    * add key press. when user press enter, automatically, user log in to system
    */     
 /// <summary>
 /// Key events on form. when user press enter, automatically, user log in to system
 /// </summary>
 /// <param name="msg">Message</param>
 /// <param name="keyData">Key data </param>    
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (this.passwordEd.Focused&&keyData.Equals(Keys.Enter))
     {
         try
         {
             isLoginOk = false;
             if (DoLogin())
             {
                 isLoginOk = true;
                 this.Close();
             }
         }
         catch (Exception er)
         {
             this.ShowError(er);
             common.system.ShowErrorMessage(Languages.Libs.GetString("systemError"));
         }
     }
     return base.ProcessCmdKey(ref msg, keyData);
 }
开发者ID:oghenez,项目名称:trade-software,代码行数:29,代码来源:investorLogin.cs

示例9: Player

        public Player(Game1 g, ContentManager cm, String name, Vector2 startLocation, Keys forwardKey, Color color, bool flip, int tWidth)
        {
            this.g = g;
            this.cm = cm;
            this.location = startLocation;
            this.name = name;
            this.flipHorizontal = flip;
            this.color = color;
            this.tWidth = tWidth;

            hitBox = this.cm.Load<Texture2D>("Hitbox");

            Stand = this.cm.Load<Texture2D>(this.name + "/Stand");
            WalkForward = this.cm.Load<Texture2D>(this.name + "/WalkForward");
            WalkBack = this.cm.Load<Texture2D>(this.name + "/WalkBack");
            Crouch = this.cm.Load<Texture2D>(this.name + "/Crouch");
            Jump = this.cm.Load<Texture2D>(this.name + "/Jump");
            JumpBack = this.cm.Load<Texture2D>(this.name + "/JumpBack");
            AtkZ = this.cm.Load<Texture2D>(this.name + "/AtkZ");
            AtkX = this.cm.Load<Texture2D>(this.name + "/AtkX");
            AtkC = this.cm.Load<Texture2D>(this.name + "/AtkC");
            ArialZ = this.cm.Load<Texture2D>(this.name + "/ArialZ");
            ArialX = this.cm.Load<Texture2D>(this.name + "/ArialX");
            ArialC = this.cm.Load<Texture2D>(this.name + "/ArialC");

            if (forwardKey.Equals(Keys.Right))
            {
                this.jumpKey = Keys.Up;
                this.crouchKey = Keys.Down;
                this.backKey = Keys.Left;
                this.forwardKey = Keys.Right;
                this.atk1Key = Keys.Z;
                this.atk2Key = Keys.X;
                this.atk3Key = Keys.C;
            }
            else if (forwardKey.Equals(Keys.D))
            {
                this.jumpKey = Keys.W;
                this.crouchKey = Keys.S;
                this.backKey = Keys.A;
                this.forwardKey = Keys.D;
                this.atk1Key = Keys.J;
                this.atk2Key = Keys.K;
                this.atk3Key = Keys.L;
            }
        }
开发者ID:R3coil,项目名称:TEST_REPOSITORY,代码行数:46,代码来源:Player.cs

示例10: Tir

 // Quand le joueur appuye sur un des boutons pour tirer
 public void Tir(Keys fire)
 {
     if (fire.Equals(Keys.Space) && alive) // on vérifie si le joueur est encore vivant et si il appuye sur la barre d'espace
     {
         Tir tir = new Tir(this); // On ajoute un nouvel objet de type tir
         tirs.Add(tir); // on ajoute à la liste des tirs du joueur
         if (totalPoint > 0) // on retranche a chaque tir un point de score (on ne descend pas en dessous de zéro)
         {
             totalPoint--;
         }
     }
     if (fire.Equals(Keys.Enter) && alive && combo == 1000 && !destruction) // on vérifie si le joueur appuye sur enter, si il est vivant et si sa jauge est rempli pour pouvoir faire le super tir
     {
         combo = 0; // on remet la jauge a zéro
         destruction = true; // on envoie au panel le fait que le joueur a déclanché son super tir
     }
 }
开发者ID:Boucquey,项目名称:projetInfo,代码行数:18,代码来源:Joueur.cs

示例11: OnKeyPressed

 protected override void OnKeyPressed(Keys keyData)
 {
     if (keyData.Equals(Keys.Escape))
     {
         FindReplace.CloseDialogIfNeeded();
     }
 }
开发者ID:CisBetter,项目名称:ags,代码行数:7,代码来源:DialogEditor.cs

示例12: isKeyToAutocomplete

        private bool isKeyToAutocomplete(Keys key)
        {
            if (key.Equals(Keys.Enter) || key.Equals(Keys.Space) || key.Equals(Keys.Tab) || (key.Equals(Keys.OemPipe) && (Control.ModifierKeys == Keys.Shift)))
                return true;

            return false;
        }
开发者ID:dineshkummarc,项目名称:SWAT_4.1_Binaries_Source,代码行数:7,代码来源:SwatAuto_Complete.cs

示例13: keyboard_KeyReleased

        void keyboard_KeyReleased(Keys key)
        {
            //Quit game when escape is pressed
            if (key.Equals(Keys.Escape))
                game.Exit();

            //stop scrolling if mouse is in the middle
            MouseState ms = mouse.GetState();
            if (key.Equals(Keys.Right) && !(ms.X > viewport.Width * 0.95))
                baseGame.scrollRight = false;
            if (key.Equals(Keys.Left) && !(ms.X < viewport.Width * 0.05))
                baseGame.scrollLeft = false;
            if (key.Equals(Keys.Up) && !(ms.Y < viewport.Height * 0.05))
                baseGame.scrollUp = false;
            if (key.Equals(Keys.Down) && !(ms.Y > viewport.Height * 0.95))
                baseGame.scrollDown = false;

            //
            if (key.Equals(Keys.M))
            {
                if (baseGame.menuOpen)
                {
                    baseGame.menuOpen = false;
                    gui.Screen = gameScreen;
                }
                else
                {
                    enterMenu();
                }
            }
            if (key.Equals(Keys.Space))
            {
                effects.addFloatingString("CAT!!",new Vector2(ms.X,ms.Y),Color.Red);
            }
        }
开发者ID:kevinh111,项目名称:CircleOfLife,代码行数:35,代码来源:User.cs

示例14: updateListBoxSelection

        private void updateListBoxSelection(Keys key)
        {
            //handle key up on the listbox
            if (key.Equals(Keys.Up))
            {
                if (this.listBox.SelectedIndex > 0)
                {
                    listBox.SelectedIndex--;
                }
                else
                    listBox.SelectedIndex = 0;
            }
            //handle key down on the listbox
            else if (key.Equals(Keys.Down))
            {
                if (this.listBox.SelectedIndex < this.listBox.Items.Count - 1)
                    this.listBox.SelectedIndex++;
            }

            if (!isUpOrDownKey(key))
            {
                string currentText = getTextToSelectListBox();
                int matchingIndex = this.listBox.FindString(currentText);

                if (currentText.Equals("") || matchingIndex == ListBox.NoMatches)
                    this.listBox.ClearSelected();
                else
                {
                    this.listBox.SelectedIndex = matchingIndex;
                }
            }
        }
开发者ID:dineshkummarc,项目名称:SWAT_4.1_Binaries_Source,代码行数:32,代码来源:SwatAuto_Complete.cs

示例15: ProcessDialogKey

		protected override bool ProcessDialogKey(Keys keyData)
		{	
			if (keyData.Equals(Keys.Delete)) {
				ArrayList itemsToRemove = new ArrayList(soundItems.Count);
				this.Enabled = false;
				propertyGrid.SelectedObject = null; 
				foreach (SoundItem sm in soundItems) {
					if (sm.Selected) {
						itemsToRemove.Add(sm);
					}
				}
				foreach (SoundItem sm in itemsToRemove) {
					soundItems.Remove(sm);
					sm.Dispose();
				}
				this.Enabled = true;
				this.Invalidate();
				this.Update();
			}
			return base.ProcessDialogKey(keyData);
		}
开发者ID:sanyaade-g2g-repos,项目名称:knack,代码行数:21,代码来源:SoundItemTree.cs


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