Skip to content

Instantly share code, notes, and snippets.

@viko16
Created August 13, 2013 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viko16/6222687 to your computer and use it in GitHub Desktop.
Save viko16/6222687 to your computer and use it in GitHub Desktop.
点击退出时需要确认 #winform
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
// 关闭所有的线程
this.Dispose();
this.Close();
}
else
e.Cancel = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment