选择性退出窗体

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;
}
}

posted @ 2015-05-13 10:42  shuke2016  阅读(147)  评论(0编辑  收藏  举报