程序退出前的确认操作
代码语言:javascript复制 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result = MessageBox.Show("确认退出吗?","退出询问"
,MessageBoxButtons.OKCancel,MessageBoxIcon.Question);
if(result != DialogResult.OK)
{
e.Cancel = true;//告诉窗体关闭这个任务取消
}
}