软件编程
位置:首页>> 软件编程>> C#编程>> c# 关闭窗体时提示的小例子

c# 关闭窗体时提示的小例子

  发布时间:2021-11-10 19:08:18 

标签:关闭,窗体,提示


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;
            }
        }

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com