日期:2014-05-17  浏览次数:20991 次

调用关闭窗体里面的e.cancel,显示未定义
private void Main_FormClosed(object sender, FormClosedEventArgs e)
        {
            if(baocun==false)
            {
                if(richTextBox1.Text!="")
                {
                    string msg = "当前文本内容不为空,是否保存";

                    if (baocun == false && filepath != "")
                        msg = "内容已经发生变化,是否保存";

                    switch (MessageBox.Show(msg,"警告",MessageBoxButtons.YesNoCancel))
                    {
                        case DialogResult.Yes:
                            if(SaveFile())
                            {
                                Application.Exit();
                            }
                            break;
                        case DialogResult.No:
                            e.Cancel = false;
                            break;
                        case DialogResult.Cancel:
                            e.Cancel = true;
                            break;

                    }
                }
&n