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


C# KeyEventArgs类代码示例

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


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


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