Exemplo n.º 1
0
 /// <summary>
 /// Opens a new Text Editor window instance as a child window and opens an existing text file with it.
 /// </summary>
 private void FileOpen(object sender, EventArgs e)
 {
     // If there's at least one MdiChild.
     if (this.MdiChildren.Length > 0)
     {
         // If current window is a text editor window.
         if (this.ActiveMdiChild.GetType() == typeof(formTextEditor))
         {
             // Cast the active window to a texteditor window.
             formTextEditor texteditorInstance = (formTextEditor)this.ActiveMdiChild;
             // Call the active window's open operation.
             texteditorInstance.FileOpen(sender, e);
         }
         // The current window is not a textedtor window. Report that.
         else
         {
             MessageBox.Show("Open is not supported for the current active window.", "Open Not Suported");
         }
     }
     // There is no child window. Report that.
     else
     {
         formTextEditor texteditorInstance = new formTextEditor();
         texteditorInstance.MdiParent = this;
         texteditorInstance.Show();
         // Cast the active window to a whiteboard window.
         formTextEditor texteditorInstance2 = (formTextEditor)this.ActiveMdiChild;
         // Call the active window's copy operation.
         texteditorInstance2.FileOpen(sender, e);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Opens a new Text Editor window instance as a child window.
        /// </summary>
        private void FileNew(object sender, EventArgs e)
        {
            formTextEditor texteditorInstance = new formTextEditor();

            texteditorInstance.MdiParent = this;
            texteditorInstance.Show();
        }