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