private void 中级自测题SToolStripMenuItem_Click(object sender, EventArgs e) { this.IsMdiContainer = true; //将mainform窗体设置为父窗体 this.label1.Visible = false; //隐藏父窗体上的标题文字; this.pictureBox1.Visible = false; //隐藏父窗体上的标题文字 this.label2.Visible = false; //隐藏父窗体上的版权文本 SecondaryExmForm SFrm = new SecondaryExmForm(); SFrm.MdiParent = this; SFrm.Show(); }
private void SecondaryExmForm_FormClosing(object sender, FormClosingEventArgs e) { //注:\n表示文本换行 if (MessageBox.Show(this, "确定要关闭当前窗体吗?是请点击‘确定’\n按钮,否则,请点击‘取消’按钮。", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { SecondaryExmForm SFrm = new SecondaryExmForm(); SFrm.Close(); } else { e.Cancel = true; } }