private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (DialogResult.Yes == MessageBox.Show("您确定要离开系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
{
Application.Exit();
WriteRecord("关机记录:"+ DateTime.Now.ToString());
}
else
{
e.Cancel = true;
}
}
收到的代码.基本写的一样!可我的退出需要点击两次!
{
if (DialogResult.Yes == MessageBox.Show("您确定要离开系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
{
Application.Exit();
WriteRecord("关机记录:"+ DateTime.Now.ToString());
}
else
{
e.Cancel = true;
}
}
收到的代码.基本写的一样!可我的退出需要点击两次!
解决方案 »
- C++中的vector,pair是C#中的什么类型
- list《》怎么删除一项
- InitialData控件
- 想给PictureBox 通过重绘(GDI+)的方式加个边框,怎么不行了?
- WinForm中如何实现打印特定区域,如何合并DataGrid的单元格?请教高手!!!
- 国内外著名的PDA开发网址.
- 小数问题?
- 搜遍了整个CSDN,也没找到答案,恳求大侠进来解决.新手共来参考...
- 如何画连接两点的曲线?解决就给分
- 请教:关于SqlDataAdapter.Update
- System.Runtime.InteropServices.COMException:“类型不匹配,错误代码:80020005
- 控制台使用HttpClient服务器无法获取到数据
Application.Exit();
WriteRecord("关机记录:"+ DateTime.Now.ToString());
可以改成
Environment.Exit(0);
除非你是程序的进程退的不彻底才考虑用这些哈