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

C# KeyEventArgs类代码示例

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

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



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

示例1: KeyToString

		protected override string KeyToString(KeyEventArgs args) {
			if (args.Alt) {
				switch (args.Key) {
					case Keys.A:
						return (args.Shift) ? "¥" : "¹";
					case Keys.C:
						return (args.Shift) ? "Æ" : "æ";
					case Keys.E:
						return (args.Shift) ? "Ê" : "ê";
					case Keys.L:
						return (args.Shift) ? "£" : "³";
					case Keys.N:
						return (args.Shift) ? "Ñ" : "ñ";
					case Keys.O:
						return (args.Shift) ? "Ó" : "ó";
					case Keys.S:
						return (args.Shift) ? "Œ" : "œ";
					case Keys.X:
						return (args.Shift) ? "" : "Ÿ";
					case Keys.Z:
						return (args.Shift) ? "¯" : "¿";
				}
			}
			return base.KeyToString(args);
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:25,代码来源:PolishKeyboardLayout.cs


示例2: OnKeyDown

 protected override void OnKeyDown(KeyEventArgs ke)
 {
     // Block Ctrl+Tab and Ctrl+Shift+Tab hotkeys
     if (ke.Control && ke.KeyCode == Keys.Tab)
         return;
     base.OnKeyDown(ke);
 }
开发者ID:desperate-man,项目名称:FileRandomizer3000,代码行数:7,代码来源:WizardControl.cs


示例3: OnKeyDown

 protected override void OnKeyDown(KeyEventArgs kea)
 {
     if (kea.KeyCode == Keys.Escape)
     {
         this.Close();
     }
 }
开发者ID:dbremner,项目名称:hycs,代码行数:7,代码来源:helloForm.cs


示例4: OnKeyDown

        void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == GameConsoleOptions.Options.ToggleKey)
            {
                ToggleConsole();
                isHandled = true;
            }

            switch (e.KeyCode)
            {
                case Keys.Enter:
                    ExecuteBuffer();
                    break;
                case Keys.Back:
                    if (Buffer.Output.Length > 0)
                        Buffer.Output = Buffer.Output.Substring(0, Buffer.Output.Length - 1);
                    break;
                case Keys.Tab:
                    AutoComplete();
                    break;
                case Keys.Up: 
                    Buffer.Output = CommandHistory.Previous(); 
                    break;
                case Keys.Down: Buffer.Output = CommandHistory.Next(); 
                    break;
                default:
                    var @char = TranslateChar(e.KeyCode);
                    if (IsPrintable(@char))
                    {
                        Buffer.Output += @char;
                    }
                    break;
            }
        }
开发者ID:Cyberbanan,项目名称:voxeliq,代码行数:34,代码来源:InputProcessor.cs


示例5: Update

        /// <summary>
        /// updates the KeyboardControler
        /// </summary>
        public static void Update()
        {
            for(int i = 0; i<isPressed.Length; ++i)
            {
                Keyboard.Key key = (Keyboard.Key)i;

                if(!isPressed[i] && Keyboard.IsKeyPressed(key))
                {
                    KeyEventArgs e = new KeyEventArgs();
                    e.Key = Controls.Cast(key);
                    e.Shift = Keyboard.IsKeyPressed(Keyboard.Key.LShift) || Keyboard.IsKeyPressed(Keyboard.Key.RShift);
                    e.Control = Keyboard.IsKeyPressed(Keyboard.Key.LControl) || Keyboard.IsKeyPressed(Keyboard.Key.RControl);
                    e.Alt = Keyboard.IsKeyPressed(Keyboard.Key.LAlt) || Keyboard.IsKeyPressed(Keyboard.Key.RAlt);
                    OnKeyPressed(e);
                }

                isPressed[i] = Keyboard.IsKeyPressed(key);

                if(wasPressed[i] && isPressed[i] != wasPressed[i])
                {
                    KeyEventArgs e = new KeyEventArgs();
                    e.Key = Controls.Cast(key);
                    e.Shift = Keyboard.IsKeyPressed(Keyboard.Key.LShift) || Keyboard.IsKeyPressed(Keyboard.Key.RShift);
                    e.Control = Keyboard.IsKeyPressed(Keyboard.Key.LControl) || Keyboard.IsKeyPressed(Keyboard.Key.RControl);
                    e.Alt = Keyboard.IsKeyPressed(Keyboard.Key.LAlt) || Keyboard.IsKeyPressed(Keyboard.Key.RAlt);
                    OnKeyRelease(e);
                }

                wasPressed[i] = isPressed[i];
            }
        }
开发者ID:Kedreals,项目名称:MicrosoftGameJam2015AwesomeHurray,代码行数:34,代码来源:KeyboardControler.cs


示例6: OnKeyDown

        //キーが押されたとき
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Down:
                    m_tetris.MovePiece(Direction.Bottom);
                    break;

                case Keys.Left:
                    m_tetris.MovePiece(Direction.Left);
                    break;

                case Keys.Right:
                    m_tetris.MovePiece(Direction.Right);
                    break;

                case Keys.Space:
                    m_tetris.RotatePiece(Direction.Right);
                    break;

                case Keys.S:
                    m_tetris.Start();
                    break;

            }
        }
开发者ID:sbvild,项目名称:tetris,代码行数:27,代码来源:TetrisForm.cs


示例7: onKeyPress

        private void onKeyPress(object sender, KeyEventArgs e)
        {
            e.Handled = false;

            if (e.Event.Action != KeyEventActions.Down) return;

            if (e.Event.KeyCode == Keycode.Enter)
            {
                if (IsPopupShowing && ListSelection != AdapterView.InvalidPosition)
                {
                    PerformCompletion();
                    DismissDropDown();

                    e.Handled = true;

                    return;
                }

                if (!CSharpToGoApplication.Options.MultiLineEditing
                    || (CSharpToGoApplication.Options.DoubleEnterToExecute && _lastKeyPressed == Keycode.Enter))
                {
                    MessageHub.Instance.Publish(new ExecuteCodeMessage(this, Text));

                    _lastKeyPressed = null;
                    e.Handled = true;
                }
            }

            _lastKeyPressed = e.Event.KeyCode;
        }
开发者ID:jorik041,项目名称:CSharpToGo,代码行数:30,代码来源:CodeCompletionInput.cs


示例8: textBox1_KeyDown

            private void textBox1_KeyDown(object sender, KeyEventArgs e)
            {
                switch(e.KeyCode)
                {
                    case Keys.Escape:
                        DialogResult = DialogResult.Cancel;
                        this.Close();
                        break;

                    case Keys.Enter:
                        mFileToOpen = mSearchResults.Selected.fullPath;
                        DialogResult = DialogResult.OK;
                        this.Close();
                        break;

                    case Keys.Down:
                        mSearchResults.NextMatch();
                        e.Handled = true;
                        mSelectionInfo.Text = mSearchResults.Selected.fullPath;
                        break;

                    case Keys.Up:
                        mSearchResults.PrevMatch();
                        e.Handled = true;
                        mSelectionInfo.Text = mSearchResults.Selected.fullPath;
                        break;

                    case Keys.F5:
                        mFiles.Refresh();
                        break;
                }
            }
开发者ID:Nexuapex,项目名称:niftyplugins,代码行数:32,代码来源:QuickOpenDialog.cs


示例9: gkh_KeyUp

 void gkh_KeyUp(object sender, KeyEventArgs e)
 {
     if (supress)
     {
         e.SuppressKeyPress = true;
     }
 }
开发者ID:KritR,项目名称:Keyboard-Blocker,代码行数:7,代码来源:Form1.cs


示例10: TextBox_KeyDown

	void TextBox_KeyDown (Object sender, KeyEventArgs e)
	{
		_eventsText.AppendText ("TextBox => KeyDown (" + e.KeyCode + ")"
			+ Environment.NewLine);
		if (e.KeyCode == Keys.G)
			e.SuppressKeyPress = true;
	}
开发者ID:mono,项目名称:gert,代码行数:7,代码来源:MainForm.cs


示例11: MainPage_KeyDown

        private void MainPage_KeyDown(CoreWindow sender, KeyEventArgs args)
        {
            if (args.VirtualKey.Equals(VirtualKey.P) || args.VirtualKey.Equals(VirtualKey.Pause))
            {
                if (pause)
                    pause = true;
                else
                    pause = false;
            }
            if (args.VirtualKey.Equals(VirtualKey.Left)) //Bewegt die Bilder nach Links
            {
                CoverFlowControl.PreviousItem();
            }
            if (args.VirtualKey.Equals(VirtualKey.Right)) //Bewegt die Bilder nach Rechts
            {
                CoverFlowControl.NextItem();
            }

            if (args.VirtualKey.Equals(VirtualKey.R)) //Rotiert nach Rechts
            {
                
                CoverFlowControl.SelectedCoverItem.ZRotation -= 90;
            }
            if (args.VirtualKey.Equals(VirtualKey.L)) //Rotiert nach Rechts
            {

                CoverFlowControl.SelectedCoverItem.ZRotation += 90;
            }


        }
开发者ID:Deadkraut,项目名称:chris2013,代码行数:31,代码来源:MainPage.xaml.cs


示例12: CoreWindow_KeyDown

 private void CoreWindow_KeyDown(CoreWindow sender, KeyEventArgs args)
 {
     if (args.VirtualKey == VirtualKey.Escape)
     {
         Reset();
     }
 }
开发者ID:kfwls,项目名称:GTRhacktastic,代码行数:7,代码来源:MainPage.xaml.cs


示例13: ListView_KeyDown

	void ListView_KeyDown (object sender, KeyEventArgs e)
	{
		if (_listView.SelectedItems.Count > 0) {
			_listView.SelectedItems [0].Text = "Key " + e.KeyCode;
			_listView.SelectedItems [0].SubItems [1].Text = "Key " + e.KeyCode;
		}
	}
开发者ID:mono,项目名称:gert,代码行数:7,代码来源:MainForm.cs


示例14: OnKeyDown

 private void OnKeyDown(CoreWindow sender, KeyEventArgs args)
 {
     if (!isInPage)
         return;
     if (args.VirtualKey == VirtualKey.Back && word.FocusState == FocusState.Unfocused)
         OnDelClicked(del, null);
 }
开发者ID:XZiar,项目名称:WordsLinks,代码行数:7,代码来源:WritePage.xaml.cs


示例15: GameForm_KeyDown

 private void GameForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Alt && (e.KeyCode == System.Windows.Forms.Keys.F4))
     {
         e.Handled = true;
     }
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:7,代码来源:MainGame.cs


示例16: CoreWindowOnKeyDown

        private void CoreWindowOnKeyDown(CoreWindow Sender, KeyEventArgs Args)
        {
            MoveDirection? direction = null;
            if (Args.VirtualKey == VirtualKey.Up)
            {
                direction = MoveDirection.Up;
            }
            else if (Args.VirtualKey == VirtualKey.Down)
            {
                direction = MoveDirection.Down;
            }
            else if (Args.VirtualKey == VirtualKey.Left)
            {
                direction = MoveDirection.Left;
            }
            else if (Args.VirtualKey == VirtualKey.Right)
            {
                direction = MoveDirection.Right;
            }

            if (direction != null)
            {
                _gameGrid.HandleMove(direction.Value);
            }
        }
开发者ID:andrecurvello,项目名称:2048,代码行数:25,代码来源:MainPage.xaml.cs


示例17: OnKeyUp

    public void OnKeyUp(object sender, KeyEventArgs e)
    {
        //Location Logger
        if (e.KeyCode == Keys.L)
        {
           float x = Game.Player.Character.Position.X;
           float y = Game.Player.Character.Position.Y;
           float z = Game.Player.Character.Position.Z;
           string GetZoneName = Function.Call<string>(Hash.GET_NAME_OF_ZONE, x, y, z);
           Logger.Log(string.Format("Zone: {0}\t{1}", GetZoneName, Game.Player.Character.Position.ToString()));
           UI.Notify("Log Updated");
        }
        //Location Logger

        if (e.KeyCode == Keys.F10)
        {
            this.mainMenu();
        }

        if (e.KeyCode == Keys.Insert)
        {
            UI.Notify("Refreshed Script");
        }

        if(e.KeyCode == Keys.Back)
        {
            View.HandleBack();
        }
    }
开发者ID:Colata,项目名称:GTA-5-Mods,代码行数:29,代码来源:Main.cs


示例18: inputTxt_KeyDown

 private void inputTxt_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Escape) { cancelBtn_Click(sender, null); }
     if (e.KeyCode == Keys.Enter) {
         okBtn_Click(sender, null);
     }
 }
开发者ID:TomWilsonCoder,项目名称:oside,代码行数:7,代码来源:Input.cs


示例19: injectKeyDown

        //-------------------------------------------------------------------------
        /// <summary>
        /// KeyDown input event handler function.
        /// </summary>
        /// <param name="e">KeyEvent arguments.</param>
        /// <returns>True if handled.</returns>
        public override bool injectKeyDown(KeyEventArgs e)
        {
            switch (e.Key)
            {
                case Keys.W:
                    MoveDirection += GameLevelManager.directionVectorFromView(Direction.DIR_N);
                    break;

                case Keys.A:
                    MoveDirection += GameLevelManager.directionVectorFromView(Direction.DIR_W);
                    break;

                case Keys.S:
                    MoveDirection += GameLevelManager.directionVectorFromView(Direction.DIR_S);
                    break;

                case Keys.D:
                    MoveDirection += GameLevelManager.directionVectorFromView(Direction.DIR_E);
                    break;

                case Keys.Space:
                    _character.jump();
                    break;
            }

            return base.injectKeyDown(e);
        }
开发者ID:jrs1498,项目名称:GDDGame1,代码行数:33,代码来源:CharacterController.cs


示例20: CoreWindow_KeyUp

 private void CoreWindow_KeyUp(CoreWindow sender, KeyEventArgs args)
 {
     if (args.VirtualKey == VirtualKey.Down)
     {
         gameTask.SpeedDown(SPEED_VAR);
         speedUp = false;
     }
 }
开发者ID:GabrieleBenvenuti,项目名称:Tetris-UWP,代码行数:8,代码来源:GameView.xaml.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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