选择性退出窗体
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (DialogResult.Yes == MessageBox.Show("Exit or Not ?", "Tip", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
{
this.FormClosing -= new FormClosingEventHandler(this.Form1_FormClosing); //Only one click
Application.Exit();
}
{
e.Cancel = true;
}
}