Пример #1
0
        // 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);
            }
        }
Пример #2
0
        /// <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));
            }
        }
Пример #3
0
 /// <summary>
 /// Remove view from the docuemnt view's list
 /// </summary>
 /// <param name="childForm"></param>
 public void RemoveView(ChildForm childForm)
 {
     this.viewList.Remove(childForm);
 }
Пример #4
0
 /// <summary>
 /// Add view to the document view's list
 /// </summary>
 /// <param name="form"></param>
 public void AddView(ChildForm form)
 {
     this.viewList.Add(form);
 }