示例#1
0
 public void OpenPanelInCurrentForm(MyPanel PanelToAddToWindow, MainForm FormToAddOn)
 {
     RemovePanel(PanelToAddToWindow);
     FormToAddOn.IOController.AddPanel(PanelToAddToWindow);
     PanelToAddToWindow.OnOpenedInDifferentForm(FormToAddOn);
     FlowLayoutEvents.OnMainPanelLayoutChanged();
     FormToAddOn.IOController.FlowLayoutEvents.OnMainPanelLayoutChanged();
 }
示例#2
0
        /// <summary>
        /// Opens a panel in a new window
        /// </summary>
        /// <param name="PanelToAddToNewWindow">The panel to open in a new window</param>
        /// <param name="OldForm">The original form on which it was displayed</param>
        public void OpenInNewWindow(MyPanel PanelToAddToNewWindow, MainForm OldForm)
        {
            //Add a new form with a new instance of the IO controller specified by the panel being removed.
            //This means that the new form matches the type of the panel.
            this.AddForm(PanelToAddToNewWindow.ParentForm.IOController.GetNew());
            int indexOfLastForm = this.Count - 1;

            //Remove the panel from the old form and add the panel to the new one.
            OldForm.IOController.RemovePanel(PanelToAddToNewWindow);
            this[indexOfLastForm].IOController.AddPanel(PanelToAddToNewWindow);

            //Fire the opened in new form event for the panel.
            PanelToAddToNewWindow.OnOpenedInDifferentForm(this[indexOfLastForm]);

            //Show the new form.
            this[indexOfLastForm].Show();
        }