C#:按ESC就退出

设置窗体属性KeyPreview=True。
private void Form1_KeyUp(object sender, KeyEventArgs e)
{
  if (e.KeyData == Keys.Escape)Application.Exit();
}

来自:http://zhidao.baidu.com/question/17393332.html
原文地址:https://www.cnblogs.com/Kprogram/p/2857871.html