??????????????е????????д??????????????
???????????£????譎???????á?
????WPF??? ??????
public MainWindow()
{
this.InitializeComponent();
EventManager.RegisterClassHandler(typeof(Window)??
Keyboard.KeyUpEvent?? new KeyEventHandler(Soc_KeyDown)?? true);
}
private void Clear_Click(object sender?? RoutedEventArgs e)
{
txb_history.Text = "";
txt_thiskey.Text = "";
}
private void Soc_KeyDown(object sender?? KeyEventArgs e)
{
Key k = e.Key;
string Ks = k.ToString();
if (k == Key.System)
{
Ks = "F10";
}
txt_thiskey.Text = Ks;
string history = "";
if (txb_history.Text != "")
{
history = txb_history.Text + "??";
}
history += Ks;
List<String> KeyList = history.Split('??').ToList();
if (KeyList.Count > 10)
{
KeyList.RemoveAt(0);
}
history = "";
foreach (var key in KeyList)
{
history += key + "??";
}
history = history.Substring(0?? history.Length - 1);
txb_history.Text = history;
}