Esempio n. 1
0
        /// <summary>
        /// <para>Removes a control from the form.</para>
        /// <para>If the control is not on the form, the form it is on is located and the panel is removed from this form.</para>
        /// </summary>
        /// <param name="ControlToRemove">The IDockableControl to remove from the form</param>
        public void RemovePanel(IDockableControl ControlToRemove)
        {
            if (((MyPanel)ControlToRemove).ParentForm.FormIndex == AssociatedForm.FormIndex)
            {
                if (ControlToRemove.Type == typeof(MyPanel))
                {
                    int panelIndexToRemove = ((MyPanel)ControlToRemove).PanelIndex;

                    if (!ControlToRemove.Removed)
                    {
                        if (!((MyPanel)ControlToRemove).InContentPanel)
                        {
                            Toolbar.RemovePanel(panelIndexToRemove);
                            MainPanel.RemoveControl(ControlToRemove);
                            foreach (MyPanel p in MainPanel.VisiblePanels)
                            {
                                if (p.PanelIndex > panelIndexToRemove)
                                {
                                    p.PanelIndex--;
                                }
                            }
                        }
                    }
                    ((MyPanel)ControlToRemove).OnPanelClosed(AssociatedForm);
                    FlowLayoutEvents.OnMainPanelLayoutChanged();
                }
                else
                {
                    FormCollection[((MyPanel)ControlToRemove).ParentForm.FormIndex].IOController.RemovePanel(ControlToRemove);
                }
            }
        }
Esempio n. 2
0
 public void OpenPanelInCurrentForm(MyPanel PanelToAddToWindow, MainForm FormToAddOn)
 {
     RemovePanel(PanelToAddToWindow);
     FormToAddOn.IOController.AddPanel(PanelToAddToWindow);
     PanelToAddToWindow.OnOpenedInDifferentForm(FormToAddOn);
     FlowLayoutEvents.OnMainPanelLayoutChanged();
     FormToAddOn.IOController.FlowLayoutEvents.OnMainPanelLayoutChanged();
 }
Esempio n. 3
0
 /// <summary>
 /// Adds a control to the form.
 /// </summary>
 /// <param name="ControlToAdd">The IDockableControl to add to the form</param>
 public void AddPanel(IDockableControl ControlToAdd)
 {
     if (ControlToAdd != null && ControlToAdd.Removed)
     {
         MainPanel.AddControl(ControlToAdd, true);
         if (ControlToAdd.Type == typeof(MyPanel))
         {
             Toolbar.AddPanel(((MyPanel)ControlToAdd).PanelIndex);
             ((MyPanel)ControlToAdd).OnPanelOpened(AssociatedForm);
         }
         if (ControlToAdd.Type == typeof(MyToolbar))
         {
             ControlToAdd.Removed = false;
         }
     }
     FlowLayoutEvents.OnMainPanelLayoutChanged();
 }