C# 退出提示 事件提示两次问题
private void frmCtiState_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (e.CloseReason == CloseReason.ApplicationExitCall)
- return;
- DialogResult result = MessageBox.Show("是否退出系统?", "消息", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (result == DialogResult.No)
- {
- e.Cancel = true;
- return;
- }
- else
- {
- e.Cancel = false;
- Application.Exit();
- }