设置窗体属性KeyPreview=True。 private void Form1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Escape)Application.Exit(); } 转载于:https://www.cnblogs.com/runliuv/p/3210597.html