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