// add new window (yet another view for the document) private void windowNewWindowMenuItem_Click(object sender, EventArgs e) { if (this.ActiveMdiChild is ChildForm) { BMDocument doc = (this.ActiveMdiChild as ChildForm).Document; ChildForm form = new ChildForm(doc); form.MdiParent = this; form.Show(); doc.AddView(form); } }
/// <summary> /// Opens and add file /// </summary> /// <param name="fileName">name of the file</param> private void OpenFile(string fileName) { try { // create document BMDocument doc = new BMDocument(fileName); // create view ChildForm form = new ChildForm(doc); form.MdiParent = this; form.Show(); // adding view to main form doc.AddView(form); } catch (Exception ex) { MessageBox.Show(String.Format("Image file {0} coouldn't be loaded due error : {1}", fileName, ex.Message)); } }