private void Form1_Deactivate(object sender, EventArgs e) //每当窗体停用的时候发生的事件,在窗体外面点击,其实就还是窗体失去焦点
{
this.Close();
}
private void shutdown(object sender, EventArgs e)
{
this.Close();
} private void Form2_Load(object sender, EventArgs e)
{
this.LostFocus += new EventHandler(shutdown);
}