private void newToolStripMenuItem_Click(object sender, EventArgs e) { InputForm newMDIChild = new InputForm(); // Sets the Parent form of the Child window. newMDIChild.MdiParent = this; // Displays the new form newMDIChild.Show(); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = openWavFile.ShowDialog(); // I want to open this to the child window in the file if (result == DialogResult.OK) // checks if the result returned true { Form openForm = this.ActiveMdiChild; if (openForm != null) { if (openForm.GetType() == typeof(InputForm)) { InputForm openToChild = (InputForm)this.ActiveMdiChild; openToChild.OpenFile(openWavFile.FileName); return; } } // if there is no child window of InputForm, open a new one InputForm childWnd = new InputForm(); childWnd.OpenFile(openWavFile.FileName); // opens the file of the specified type in the child window childWnd.MdiParent = this; childWnd.Show(); // enter the child window } }
private void newInputWindowToolStripMenuItem_Click(object sender, EventArgs e) { // Checks if there is already a child form of this type open foreach (Form form in Application.OpenForms) { if(form.GetType() == typeof(InputForm)) { form.Activate(); return; } } InputForm newMDIChild = new InputForm(); // Sets the Parent form of the Child window. newMDIChild.MdiParent = this; // Displays the new form newMDIChild.Show(); }