private void SecondaryExamForm_FormClosing(object sender, FormClosingEventArgs e) { if (MessageBox.Show(this, "确定要关闭当前窗体吗?是,请单击‘确定’\n按钮,否则,请单击‘取消’按钮。", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { SecondaryExamForm SFrm = new SecondaryExamForm(); SFrm.Close(); } else { e.Cancel = true; } }
private void 中级自测试题SToolStripMenuItem_Click(object sender, EventArgs e) { //隐藏父窗体上的标题文本 this.label1.Visible = false; //隐藏父窗体上的修饰图片 this.pictureBox1.Visible = false; //隐藏父窗体上的版权文本 this.label2.Visible = false; //将MainForm窗体设置为父窗体,此行代码功能与步骤(1)等效,二者可取其一 //this.IsMdiContainer = true; //实例化PrimaryExamForm SecondaryExamForm PFrm = new SecondaryExamForm(); //调用方法Show方法,显示窗体PFrm PFrm.MdiParent = this; //调用Show方法,显示窗体PFrm PFrm.Show(); }