internal void Refresh()
        {
            Items.Clear();
            for (int i = 0; i < NestedPanes.Count; i++)
            {
                DockPane            pane   = NestedPanes[i];
                NestedDockingStatus status = pane.NestedDockingStatus;
                status.SetDisplayingStatus(true, status.PreviousPane, status.Alignment, status.Proportion);
                Items.Add(pane);
            }

            foreach (DockPane pane in NestedPanes)
            {
                if (pane.DockState != DockState || pane.IsHidden)
                {
                    pane.Bounds         = Rectangle.Empty;
                    pane.SplitterBounds = Rectangle.Empty;
                    Remove(pane);
                }
            }

            CalculateBounds();

            foreach (DockPane pane in this)
            {
                NestedDockingStatus status = pane.NestedDockingStatus;
                pane.Bounds            = status.PaneBounds;
                pane.SplitterBounds    = status.SplitterBounds;
                pane.SplitterAlignment = status.Alignment;
            }
        }
Exemple #2
0
        private void InternalRemove(DockPane pane)
        {
            if (!Contains(pane))
            {
                return;
            }

            NestedDockingStatus statusPane     = pane.NestedDockingStatus;
            DockPane            lastNestedPane = null;

            for (int i = Count - 1; i > IndexOf(pane); i--)
            {
                if (this[i].NestedDockingStatus.PreviousPane == pane)
                {
                    lastNestedPane = this[i];
                    break;
                }
            }

            if (lastNestedPane != null)
            {
                int indexLastNestedPane = IndexOf(lastNestedPane);
                Items.Remove(lastNestedPane);
                Items[IndexOf(pane)] = lastNestedPane;
                NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;
                lastNestedDock.SetStatus(this, statusPane.PreviousPane, statusPane.Alignment, statusPane.Proportion);
                for (int i = indexLastNestedPane - 1; i > IndexOf(lastNestedPane); i--)
                {
                    NestedDockingStatus status = this[i].NestedDockingStatus;
                    if (status.PreviousPane == pane)
                    {
                        status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion);
                    }
                }
            }
            else
            {
                Items.Remove(pane);
            }

            statusPane.SetStatus(null, null, DockAlignment.Left, 0.5);
            statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5);
            statusPane.SetDisplayingBounds(Rectangle.Empty, Rectangle.Empty, Rectangle.Empty);
        }