触发窗体事件(例如按Esc关闭窗体)

 

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

 

原文地址:https://www.cnblogs.com/linyijia/p/2080799.html