private void 打开OCtrlOToolStripMenuItem_Click(object sender, EventArgs e) { try { if (openFileDialog.ShowDialog() == DialogResult.OK) { RichTextBoxStreamType fileType = TrunFileType(openFileDialog.FilterIndex); fileCount++; file = new FormChild(fileType, openFileDialog.FileName, openFileDialog.FilterIndex); file.MdiParent = this; file.Show(); listFormChild.Add(file); } } catch (Exception ex) { return; } string str = openFileDialog.FileName; string[] sArray = str.Split('\\'); file.Text = sArray[sArray.Length - 1]; file.WindowState = FormWindowState.Maximized; }
private void 新建NCtrlNToolStripMenuItem_Click(object sender, EventArgs e) { file = new FormChild(); //新建一个子窗体 file.MdiParent = this; //定义此窗体的父窗体,使之成为MDI窗体 ++ChildFormCount; file.Text = "子窗体" + ChildFormCount.ToString(); file.Show(); }