/// <summary> /// Split two forms in vertically splitted view /// </summary> /// <param name="topFormTabbedView">view to dock top</param> /// <param name="bottomFormTabbedView">view to dock bottom</param> /// <param name="parentContainer">parent container which will host the two forms</param> private static void SplitVertically(FormsTabbedView topFormTabbedView, FormsTabbedView bottomFormTabbedView, DockableContainer parentContainer) { DockableContainer newBottomFormContainer = new DockableContainer(); DockableContainer newTopFormContainer = new DockableContainer(); parentContainer.SetModeVSplit(newTopFormContainer, newBottomFormContainer); newBottomFormContainer.SetModeSingleChild(bottomFormTabbedView); newTopFormContainer.SetModeSingleChild(topFormTabbedView); }
/// <summary> /// Split two forms in vertically splitted view /// </summary> /// <param name="topFormTabbedView">view to dock top</param> /// <param name="bottomFormTabbedView">view to dock bottom</param> /// <param name="parentContainer">parent container which will host the two forms</param> private static void SplitVertically(FormsTabbedView topFormTabbedView, FormsTabbedView bottomFormTabbedView, DockableContainer parentContainer) { DockableContainer newBottomFormContainer = new DockableContainer(); DockableContainer newTopFormContainer = new DockableContainer(); parentContainer.SetModeVSplit(newTopFormContainer, newBottomFormContainer); newBottomFormContainer.SetModeSingleChild(bottomFormTabbedView); newTopFormContainer.SetModeSingleChild (topFormTabbedView); }
/// <summary> /// Remove the container /// </summary> /// <param name="container">container to remove</param> private void RemoveContainer(DockableContainer container) { Debug.Assert(container.Parent != null, "Docked container must be hosted somewere"); container.SetModeEmpty(); DockableContainer containerParent = container.Parent as DockableContainer; if (containerParent == null) { Debug.Assert(container.Parent.Handle == _host.Handle, "Parents of FormsTabbedView should be only DockableContainer or _host"); } else { DockableContainer otherContainer = containerParent.OtherPane(container); Debug.Assert(otherContainer != null, "Container in container means that parent container has contained two containers and a splitter"); FormsTabbedView otherView = otherContainer.SingleChild; FormsTabbedView linkedView = otherContainer.LinkedView; if (otherView == null && linkedView == null) { if (otherContainer.LeftPane != null) { DockableContainer leftPane = otherContainer.LeftPane; DockableContainer rightPane = otherContainer.RightPane; otherContainer.SetModeEmpty(); containerParent.SetModeHSplit(leftPane, rightPane); } else if (otherContainer.TopPane != null) { DockableContainer topPane = otherContainer.TopPane; DockableContainer bottomPane = otherContainer.BottomPane; otherContainer.SetModeEmpty(); containerParent.SetModeVSplit(topPane, bottomPane); } } else { Debug.Assert((otherView == null || linkedView == null), "Other container must have a view"); otherContainer.SetModeEmpty(); if (otherView != null) { containerParent.SetModeSingleChild(otherView); } else { containerParent.SetModeLinked(linkedView); AutoHidePanel linkedPanel = (AutoHidePanel)linkedView.Parent; linkedPanel.RestoreParent = containerParent; Autohide.HideRestoreContainers(linkedPanel); } // If floating container inside host if (containerParent.Parent.Handle == _host.Handle && containerParent.Dock == DockStyle.None) { Debug.Assert(linkedView == null, "Can't have linked view in floating container"); SetViewDock(otherView, DockStyle.None, DockStyle.None, zDockMode.None); } } otherContainer.Parent = null; otherContainer.Splitter.Parent = null; otherContainer.Dispose(); } container.Parent = null; container.Splitter.Parent = null; container.Dispose(); }