/// <summary> /// 处理按键, 确定键关闭窗口 /// </summary> /// <param name="code">按键</param> /// <returns>返回一个布尔值,标示按键是否被处理</returns> public override bool HandleKeyDown(System.Windows.Forms.Keys code) { if (IsEnd) { Close(); return(true); } if (code == System.Windows.Forms.Keys.Q && Monster.AllowQuit) { Monster.Quit(); QuitWaiting = true; return(true); } return(false); }