本文整理汇总了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);
}
示例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);
}
示例3: OnKeyDown
protected override void OnKeyDown(KeyEventArgs kea)
{
if (kea.KeyCode == Keys.Escape)
{
this.Close();
}
}
示例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;
}
}
示例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];
}
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例9: gkh_KeyUp
void gkh_KeyUp(object sender, KeyEventArgs e)
{
if (supress)
{
e.SuppressKeyPress = true;
}
}
示例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;
}
示例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;
}
}
示例12: CoreWindow_KeyDown
private void CoreWindow_KeyDown(CoreWindow sender, KeyEventArgs args)
{
if (args.VirtualKey == VirtualKey.Escape)
{
Reset();
}
}
示例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;
}
}
示例14: OnKeyDown
private void OnKeyDown(CoreWindow sender, KeyEventArgs args)
{
if (!isInPage)
return;
if (args.VirtualKey == VirtualKey.Back && word.FocusState == FocusState.Unfocused)
OnDelClicked(del, null);
}
示例15: GameForm_KeyDown
private void GameForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.Alt && (e.KeyCode == System.Windows.Forms.Keys.F4))
{
e.Handled = true;
}
}