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
posted @ 2013-01-12 19:33  混蛋程序员  阅读(815)  评论(0编辑  收藏  举报