退出程序时进行确认提醒:
private void 当前窗体类名t_FormClosing(object sender, FormClosingEventArgs e)
{
//下面是确认退出代码
DialogResult result;
result = MessageBox.Show("确定退出吗?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK)
{
//Application.ExitThread();
e.Cancel = true;
}
else
{
e.Cancel = true;
}
}
private void 当前窗体类名t_FormClosing(object sender, FormClosingEventArgs e)
{
//下面是确认退出代码
DialogResult result;
result = MessageBox.Show("确定退出吗?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK)
{
//Application.ExitThread();
e.Cancel = true;
}
else
{
e.Cancel = true;
}
}