c# 关闭窗体时提示的小例子
2014-09-05来源:易贤网

这篇文章介绍了c#中关闭窗体时提示的小例子代码,有需要的朋友可以参考一下

代码如下:

private void WorkflowConfigure_FormClosing(object sender, FormClosingEventArgs e)

{

DialogResult result = MessageBox.Show("此操作会丢弃您的当前设置,确定要继续?", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DialogResult.Yes == result)

{

e.Cancel = false; // Cancel属性如果为true,表示取消该事件的执行。

}

else

{

e.Cancel = true;

}

}

更多信息请查看IT技术专栏

2026公务员·事业单位培训课程试听报名

  • 报班类型
  • 姓名
  • 手机号
  • 验证码
推荐信息