📄 xhotkeyinputbox.cs
字号:
namespace Imps.Client.Pc.Controls
{
using Imps.Client.Pc;
using Imps.Client.Utils;
using System;
using System.Diagnostics;
using System.Windows.Forms;
public class XHotKeyInputBox : XTextBox
{
private Imps.Client.Utils.HotKey _hk;
private string _noneText = "";
public XHotKeyInputBox()
{
this.set_ContextMenuStrip(new ContextMenuStrip());
this.Text = this.NoneText;
base.ImeMode = ImeMode.Disable;
}
protected override void OnKeyDown(KeyEventArgs e)
{
try
{
e.Handled = true;
e.set_SuppressKeyPress(true);
short keyState = InnerWin32.GetKeyState(0x5b);
if ((keyState & 0x8000) == 0)
{
keyState = InnerWin32.GetKeyState(0x5c);
}
bool win = (keyState & 0x8000) != 0;
Keys modifiers = ((e.Modifiers == Keys.None) && !win) ? (Keys.Alt | Keys.Control) : e.Modifiers;
this._hk = new Imps.Client.Utils.HotKey(e.KeyCode, modifiers, win);
this.Text = this._hk.ToString();
base.OnKeyDown(e);
}
catch (Exception exception)
{
Trace.WriteLine(exception.ToString());
}
}
protected override void OnKeyUp(KeyEventArgs e)
{
try
{
if ((this._hk == null) || !this._hk.IsValid)
{
this.Text = this.NoneText;
}
base.OnKeyUp(e);
}
catch (Exception exception)
{
Trace.WriteLine(exception.ToString());
}
}
public Imps.Client.Utils.HotKey HotKey
{
get
{
if (this._hk == null)
{
this._hk = new Imps.Client.Utils.HotKey();
}
return this._hk;
}
set
{
this._hk = value;
this.Text = ((this._hk == null) || !this._hk.IsValid) ? this.NoneText : this._hk.ToString();
}
}
public string NoneText
{
get
{
return this._noneText;
}
set
{
this._noneText = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -