/// <summary> /// Add form to guider /// </summary> /// <param name="form">form to guide</param> /// <param name="allowedDock">allowed dock</param> /// <param name="formIdentifier">identifier of the form added</param> /// <returns>object that encapsulates relevant information for the guided form</returns> public DockableFormInfo Add(Form form, DockAllowed allowedDock, Guid formIdentifier) { if (GetFormInfo(form) != null) { throw new ArgumentException("Err"); } // Should set the border as None to prevent Microsoft bug in TextBox: // TextBox on Form with TopLevel = False and FormBorderStyle != None doesn't process Click event form.FormBorderStyle = FormBorderStyle.None; Rectangle bounds = form.Bounds; DockableFormInfo info = new DockableFormInfo(form, allowedDock, formIdentifier); info.ExplicitDisposing += OnInfoDisposing; info.SelectedChanged += OnFormSelectedChanged; info.ShowAutoPanel += OnShowFormAutoPanel; _dockableForms.Add(info); FormsTabbedView view = CreateFormsTabbedView(bounds.Size, null); view.Add(info); _layout.CreateFloatingContainer(view, bounds); return(info); }
/// <summary> /// Add sorted floating containers to the list /// </summary> /// <param name="containers">containers</param> private void AddSortedFloatingContainers(List <DockingContainer> containers) { List <DockingContainer> containersToBringInFront = new List <DockingContainer>(); foreach (DockableFormInfo info in _dockableForms) { FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm); if (view.IsDocked) { continue; } DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm); if (_host.Contains(container) == false) { continue; } if (containersToBringInFront.Contains(container) == false) { containersToBringInFront.Add(container); } } SortContainersBasedOnTheirZOrder(containersToBringInFront); containers.AddRange(containersToBringInFront); }
/// <summary> /// On begin move a positioner using the mouse /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arguments</param> private void OnPositionerBeginMoveByMouse(object sender, EventArgs e) { DockingContainer container = sender as DockingContainer; if (container != null) { Debug.Assert(_host.Contains(container), "Only floating forms should have a container as positioner. Docked forms should have their tabbed view."); _host.MoveFirst(container); } else { FormsTabbedView view = sender as FormsTabbedView; Debug.Assert(view != null, "The positioner should wrap either a container for floating forms or a tabbed view for docked forms"); Undock(view); container = view.Parent as DockingContainer; } EventHandler <ControlEventArgs> handler = BeginMoveByMouse; if (handler != null) { ControlEventArgs args = new ControlEventArgs(container); handler(this, args); } }
/// <summary> /// Remove the form /// </summary> /// <param name="info">info about form to remove</param> public void Remove(DockableFormInfo info) { if (info == null) { return; } FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm); if (view != null) { if (view.Count == 1 && view.IsDocked) { _layout.Undock(view); } if (view.Count == 1) { _host.Remove(view.Parent); DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm); container.SetModeEmpty(); view.Remove(info); } else { if (view.Remove(info) == false) { if (SelectedFormInfo == info) { SelectedFormInfo = null; } return; } } } if (SelectedFormInfo == info) { SelectedFormInfo = null; } _dockableForms.Remove(info); info.SelectedChanged -= OnFormSelectedChanged; info.ShowAutoPanel -= OnShowFormAutoPanel; info.ExplicitDisposing -= OnInfoDisposing; if (info.IsAutoHideMode) { _autohide.ArrangeAutoButtonsPanels(); } info.Dispose(); }
/// <summary> /// On set logical dock /// </summary> /// <param name="view">view</param> /// <param name="dock">dock</param> private void OnSetHostContainerDock(FormsTabbedView view, DockStyle dock) { EventHandler <DockControlEventArgs> handler = SetHostContainerDock; if (handler != null) { DockControlEventArgs args = new DockControlEventArgs(view, dock, DockableMode.Inner); handler(this, args); } }
/// <summary> /// Start showing form /// </summary> /// <param name="form">form to show</param> /// <param name="width">width of the form</param> /// <param name="height">height of the form</param> private void StartShowForm(Form form, int width, int height) { _previewPane.Visible = false; FormsTabbedView view = HierarchyUtility.GetTabbedView(form); view.Size = new Size(width, height); view.SelectPage(form); StartAutoShowPane(view.Parent as AutoHidePanel); }
/// <summary> /// Destroy forms tabbed view /// </summary> /// <param name="formTabbedView">form tabbed view</param> private void DestroyFormsTabbedView(FormsTabbedView formTabbedView) { formTabbedView.UndockForm -= OnUndockFormFromView; formTabbedView.ContextMenuClick -= OnViewContextMenuClick; formTabbedView.AutohideClick -= OnViewAutoHideClick; formTabbedView.FormClosing -= OnFormClosing; formTabbedView.FormClosed -= OnFormClosed; formTabbedView.Dispose(); }
/// <summary> /// Undock the view /// </summary> /// <param name="view">view</param> /// <param name="floatingBounds">floating bounds</param> public void Undock(FormsTabbedView view, Rectangle floatingBounds) { DockingContainer container = (DockingContainer)view.Parent; container.SetModeEmpty(); RemoveContainer(container); CreateFloatingContainer(view, floatingBounds); }
/// <summary> /// Destroy forms tabbed view /// </summary> /// <param name="view">tabbed view</param> private void OnDestroyFormsTabbedView(FormsTabbedView view) { EventHandler <ControlEventArgs> handler = DestroyFormsTabbedView; if (handler != null) { ControlEventArgs args = new ControlEventArgs(view); handler(this, args); } }
/// <summary> /// Split two forms in horizontal splitted view /// </summary> /// <param name="leftFormTabbedView">view to dock left</param> /// <param name="rightFormTabbedView">view to dock right</param> /// <param name="parentContainer">parent container which will host the two forms</param> private static void SplitHorizontally(FormsTabbedView leftFormTabbedView, FormsTabbedView rightFormTabbedView, DockingContainer parentContainer) { DockingContainer newRightFormContainer = new DockingContainer(); DockingContainer newLeftFormContainer = new DockingContainer(); parentContainer.SetModeHSplit(newLeftFormContainer, newRightFormContainer); newRightFormContainer.SetModeSingleChild(rightFormTabbedView); newLeftFormContainer.SetModeSingleChild(leftFormTabbedView); }
/// <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, DockingContainer parentContainer) { DockingContainer newBottomFormContainer = new DockingContainer(); DockingContainer newTopFormContainer = new DockingContainer(); parentContainer.SetModeVSplit(newTopFormContainer, newBottomFormContainer); newBottomFormContainer.SetModeSingleChild(bottomFormTabbedView); newTopFormContainer.SetModeSingleChild(topFormTabbedView); }
/// <summary> /// Undock the view /// </summary> /// <param name="view">view</param> public void Undock(FormsTabbedView view) { Point mousePosition = _host.PointToClient(Control.MousePosition); DockingContainer container = (DockingContainer)view.Parent; Rectangle bounds = _host.GetBoundsInHost(container); ComputeFloatingBounds(mousePosition, view.FloatingSize, ref bounds); Undock(view, bounds); }
/// <summary> /// Occurs when pages autohide button was clicked /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arguments</param> private void OnViewAutoHideClick(object sender, EventArgs e) { FormsTabbedView view = (FormsTabbedView)sender; if (view.PagesPanel.AutoHidden) { _autohide.UnsetAutoHideMode(view); } else { _autohide.SetAutoHideMode(view); } }
/// <summary> /// Set mode single child control /// </summary> /// <param name="singleChild">single child</param> public void SetModeSingleChild(FormsTabbedView singleChild) { singleChild.Parent = null; singleChild.Dock = DockStyle.Fill; Reset(); SetModeEmpty(); base.Add(singleChild); SingleChild = singleChild; }
/// <summary> /// Update view buttons /// </summary> /// <param name="view">view</param> private static void UpdateViewButtons(FormsTabbedView view) { if (view.HostContainerDock == DockStyle.Fill) { if (view.ButtonsRenderer.GetType() != typeof(TopUnitButtonDrawer)) { view.ButtonsRenderer = new TopUnitButtonDrawer(); } } else if (view.ButtonsRenderer.GetType() != typeof(BottomUnitButtonDrawer)) { view.ButtonsRenderer = new BottomUnitButtonDrawer(); } }
/// <summary> /// Set view dock /// </summary> /// <param name="view">view</param> /// <param name="hostContainerDock">host container dock</param> /// <param name="dock">dock</param> /// <param name="mode">mode</param> public void SetViewDock(FormsTabbedView view, DockStyle hostContainerDock, DockStyle dock, DockableMode mode) { UpdateViewButtons(view); if (CanMoveByMouseFilledForms == false && hostContainerDock == DockStyle.Fill) { view.CanMoveByMouse = false; } else { view.CanMoveByMouse = true; } if (view.HostContainerDock == dock) { view.SetDock(hostContainerDock, dock, mode); return; } view.SetDock(hostContainerDock, dock, mode); view.Positioner.BeginMoveByMouse -= OnPositionerBeginMoveByMouse; view.Positioner.MoveByMouse -= OnPositionerMoveByMouse; view.Positioner.EndMoveByMouse -= OnPositionerEndMoveByMouse; view.Positioner.Dispose(); if (dock == DockStyle.None) { view.Positioner = new ControlPositioner(view.Parent); view.Positioner.MoveByMouse += OnPositionerMoveByMouse; view.Positioner.EndMoveByMouse += OnPositionerEndMoveByMouse; } else if (dock == Globals.DockAutoHide) { view.Positioner = null; return; } else { view.Positioner = new ControlPositioner(view); } view.Positioner.BeginMoveByMouse += OnPositionerBeginMoveByMouse; }
/// <summary> /// Show auto form /// </summary> /// <param name="form">form to be shown</param> public void ShowAutoForm(Form form) { FormsTabbedView view = HierarchyUtility.GetTabbedView(form); AutoHidePanel panel = view.Parent as AutoHidePanel; if (panel == null) { return; } if (_leftAutoHideButtons != null) { if (_leftAutoHideButtons.ContainsPanel(panel)) { OnLeftPaneSelectButton(this, new ControlEventArgs(form)); return; } } if (_rightAutoHideButtons != null) { if (_rightAutoHideButtons.ContainsPanel(panel)) { OnRightPaneSelectButton(this, new ControlEventArgs(form)); return; } } if (_topAutoHideButtons != null) { if (_topAutoHideButtons.ContainsPanel(panel)) { OnTopPaneSelectButton(this, new ControlEventArgs(form)); return; } } if (_bottomAutoHideButtons != null) { if (_bottomAutoHideButtons.ContainsPanel(panel)) { OnBottomPaneSelectButton(this, new ControlEventArgs(form)); return; } } }
/// <summary> /// Get the closest dockable container (first parent of given form which is dockable container) /// </summary> /// <param name="form">form</param> /// <returns>dockable container</returns> public static DockingContainer GetClosestDockableContainer(Form form) { if (form == null) { return(null); } FormsTabbedView tabbedView = GetTabbedView(form); if (tabbedView.IsAutoHideMode) { AutoHidePanel panel = (AutoHidePanel)tabbedView.Parent; return(panel.RestoreParent); } return((DockingContainer)tabbedView.Parent); }
/// <summary> /// Undock view /// </summary> /// <param name="view">view to undock</param> /// <param name="hintBounds">hint bounds</param> private void Undock(Form formToUndock, Rectangle hintBounds) { FormsTabbedView view = HierarchyUtility.GetTabbedView(formToUndock); if (view.Count == 1) { _layout.Undock(view, hintBounds); } else { DockableFormInfo info = GetFormInfo(formToUndock); FormsTabbedView newView = CreateFormsTabbedView(info.DockableForm.Size, null); newView.Add(info); _layout.CreateFloatingContainer(newView, hintBounds); } }
/// <summary> /// Auto-show the given view /// </summary> /// <param name="view">view to show</param> public void UnsetAutoHideMode(FormsTabbedView view) { AutoHidePanel panel = (AutoHidePanel)view.Parent; DockingContainer container = panel.RestoreParent; DockStyle logicalDock = DockStyle.None; if (LeftAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Left; } else if (RightAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Right; } else if (TopAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Top; } else if (BottomAutohideButtons.Remove(panel)) { logicalDock = DockStyle.Bottom; } else { Debug.Fail("Panel not found"); } _host.Remove(panel); container.SetModeSingleChild(view); OnSetHostContainerDock(view, logicalDock); view.IsAutoHideMode = false; view.PagesPanel.AutoHidden = false; ShowRestoreContainers(panel); ArrangeAutoButtonsPanels(); _autoShowPanel = null; }
/// <summary> /// Create floating container for the view /// </summary> /// <param name="view">view for which to create floating container</param> /// <param name="bounds">bounds of the floating container</param> /// <returns>floating container</returns> public DockingContainer CreateFloatingContainer(FormsTabbedView view, Rectangle bounds) { DockingContainer container = new DockingContainer(); _host.AddFirst(container); container.Bounds = bounds; container.SetModeSingleChild(view); if (EnumUtility.Contains(view.AllowedDock, DockAllowed.None)) { SetViewDock(view, DockStyle.None, DockStyle.None, DockableMode.None); } else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Left)) { DockControl(container, null, DockStyle.Left, DockableMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Right)) { DockControl(container, null, DockStyle.Right, DockableMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Top)) { DockControl(container, null, DockStyle.Top, DockableMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Bottom)) { DockControl(container, null, DockStyle.Bottom, DockableMode.Outer); } else if (EnumUtility.Contains(view.AllowedDock, DockAllowed.Fill)) { DockControl(container, null, DockStyle.Fill, DockableMode.Inner); } else { _host.Remove(container); throw new NotSupportedException("Err"); // invalid allowed dock } return(container); }
/// <summary> /// Dock fill in parent container /// </summary> /// <param name="formTabbedView">view to dock</param> /// <param name="parentTabbedView">view where will dock</param> private static void DockFillInParentContainer(FormsTabbedView formTabbedView, FormsTabbedView parentTabbedView) { Form selected = formTabbedView.GetPageAt(formTabbedView.SelectedIndex); DockableFormInfo[] movedPages = formTabbedView.MovePagesTo(parentTabbedView); foreach (DockableFormInfo movedPage in movedPages) { movedPage.Dock = DockStyle.Fill; movedPage.DockMode = DockableMode.Inner; } for (int index = 0; index < parentTabbedView.Count; index++) { if (parentTabbedView.GetPageAt(index) == selected) { parentTabbedView.SelectedIndex = index; break; } } }
/// <summary> /// Occurs when IsSelected property of a form is changed /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event argument</param> private void OnFormSelectedChanged(object sender, EventArgs e) { DockableFormInfo info = (DockableFormInfo)sender; if (info.IsSelected) { SelectedFormInfo = info; } FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm); if (view != null) { if (view.SelectedForm != null) { DockableFormInfo topFormInfo = GetFormInfo(view.SelectedForm); view.PagesPanel.ShowCloseButton = topFormInfo.ShowCloseButton; view.PagesPanel.ShowContextMenuButton = topFormInfo.ShowContextMenuButton; } } }
/// <summary> /// Create forms tabbed view /// </summary> /// <param name="size">initial size of decorator</param> /// <param name="positioner">positioner for control</param> /// <returns>forms tabbed view</returns> private FormsTabbedView CreateFormsTabbedView(Size size, ControlPositioner positioner) { FormsTabbedView view = new FormsTabbedView(); view.ShowOneTabButton = false; view.Size = size; view.PagesPanel.Positioner = positioner; view.PagesPanel.Size = size; view.PagesPanel.BackColor = SystemColors.Control; view.PagesPanel.TextColor = TitleBarTextColor; view.PagesPanel.Color1 = TitleBarGradientColor1; view.PagesPanel.Color2 = TitleBarGradientColor2; view.PagesPanel.SelectedColor1 = TitleBarGradientSelectedColor1; view.PagesPanel.SelectedColor2 = TitleBarGradientSelectedColor2; view.UndockForm += OnUndockFormFromView; view.ContextMenuClick += OnViewContextMenuClick; view.AutohideClick += OnViewAutoHideClick; view.FormClosing += OnFormClosing; view.FormClosed += OnFormClosed; return(view); }
/// <summary> /// Add sorted fill containers to the list /// </summary> /// <param name="containers">containers</param> private void AddSortedFillContainers(List <DockingContainer> containers) { List <DockingContainer> containersToBringInFront = new List <DockingContainer>(); foreach (DockableFormInfo info in _dockableForms) { FormsTabbedView view = HierarchyUtility.GetTabbedView(info.DockableForm); if (view.HostContainerDock != DockStyle.Fill) { continue; } DockingContainer container = HierarchyUtility.GetClosestDockableContainer(info.DockableForm); while (true) { if (container.Parent as DockingContainer != null) { container = (DockingContainer)container.Parent; } else { break; } } Debug.Assert(_host.Contains(container), "Floating form views must have their parent in form"); if (containersToBringInFront.Contains(container) == false) { containersToBringInFront.Add(container); } } SortContainersBasedOnTheirZOrder(containersToBringInFront); containers.AddRange(containersToBringInFront); }
/// <summary> /// Auto-hide the given view /// </summary> /// <param name="view">view to hide</param> public void SetAutoHideMode(FormsTabbedView view) { AutoHidePanel panel = new AutoHidePanel(); panel.RestoreParent = (DockingContainer)view.Parent; panel.Size = view.Size; panel.Visible = false; HideRestoreContainers(panel); panel.RestoreParent.SetModeLinked(view); view.Parent = panel; DockStyle logicalDock = view.HostContainerDock; OnSetHostContainerDock(view, Globals.DockAutoHide); view.Positioner = new ControlPositioner(panel); view.Positioner.CanMove = false; if (logicalDock == DockStyle.Left) { panel.Bounds = new Rectangle(LeftAutohideButtons.Right, LeftAutohideButtons.Top, view.Width, LeftAutohideButtons.Height); view.Positioner.CanSizeLeft = false; view.Positioner.CanSizeTop = false; view.Positioner.CanSizeBottom = false; panel.AutoHideHandler = AutoHideLeftPane; panel.AutoShowHandler = AutoShowLeftPane; LeftAutohideButtons.Add(panel); } else if (logicalDock == DockStyle.Right) { panel.Bounds = new Rectangle(RightAutohideButtons.Left - view.Width, RightAutohideButtons.Top, view.Width, RightAutohideButtons.Height); view.Positioner.CanSizeRight = false; view.Positioner.CanSizeTop = false; view.Positioner.CanSizeBottom = false; panel.AutoHideHandler = AutoHideRightPane; panel.AutoShowHandler = AutoShowRightPane; RightAutohideButtons.Add(panel); } else if (logicalDock == DockStyle.Top) { panel.Bounds = new Rectangle(TopAutohideButtons.Left, TopAutohideButtons.Bottom, TopAutohideButtons.Width, view.Height); view.Positioner.CanSizeLeft = false; view.Positioner.CanSizeRight = false; view.Positioner.CanSizeTop = false; panel.AutoHideHandler = AutoHideTopPane; panel.AutoShowHandler = AutoShowTopPane; TopAutohideButtons.Add(panel); } else if (logicalDock == DockStyle.Bottom) { panel.Bounds = new Rectangle(BottomAutohideButtons.Left, BottomAutohideButtons.Top - view.Height, BottomAutohideButtons.Width, view.Height); view.Positioner.CanSizeLeft = false; view.Positioner.CanSizeRight = false; view.Positioner.CanSizeBottom = false; panel.AutoHideHandler = AutoHideBottomPane; panel.AutoShowHandler = AutoShowBottomPane; BottomAutohideButtons.Add(panel); } else { Debug.Fail("Autohide should be available only for docked left, right, top or bottom"); return; } _host.AddFirst(panel); view.IsAutoHideMode = true; view.PagesPanel.AutoHidden = true; ArrangeAutoButtonsPanels(); }
/// <summary> /// On set logical dock /// </summary> /// <param name="sender">sender of the event</param> /// <param name="e">event arguments</param> private void OnSetHostContainerDock(object sender, DockControlEventArgs e) { FormsTabbedView view = (FormsTabbedView)e.Control; _layout.SetViewDock(view, e.Dock, view.CurrentDock, view.CurrentDockMode); }
/// <summary> /// Dock in parent container /// </summary> /// <param name="containerToDock">container to dock</param> /// <param name="containerWhereToDock">container where to dock</param> /// <param name="dock">dock</param> private void DockInParentContainer(DockingContainer containerToDock, DockingContainer containerWhereToDock, DockStyle dock) { FormsTabbedView formTabbedView = containerToDock.SingleChild; FormsTabbedView parentTabbedView = containerWhereToDock.SingleChild; containerToDock.SingleChild.SaveFloatingSize(); containerToDock.Splitter.Visible = false; containerToDock.SetModeEmpty(); if (dock != DockStyle.Fill) { containerWhereToDock.SetModeEmpty(); } RemoveContainer(containerToDock); DockStyle parentDock = DockStyle.None; switch (dock) { case DockStyle.Left: SplitHorizontally(formTabbedView, parentTabbedView, containerWhereToDock); parentDock = DockStyle.Right; break; case DockStyle.Right: SplitHorizontally(parentTabbedView, formTabbedView, containerWhereToDock); parentDock = DockStyle.Left; break; case DockStyle.Top: SplitVertically(formTabbedView, parentTabbedView, containerWhereToDock); parentDock = DockStyle.Bottom; break; case DockStyle.Bottom: SplitVertically(parentTabbedView, formTabbedView, containerWhereToDock); parentDock = DockStyle.Top; break; case DockStyle.Fill: parentDock = parentTabbedView.HostContainerDock; DockFillInParentContainer(formTabbedView, parentTabbedView); OnDestroyFormsTabbedView(formTabbedView); break; default: throw new InvalidOperationException(); } if (parentTabbedView.HostContainerDock != DockStyle.None) { // Keep the parent logical dock if already docked if (parentDock != parentTabbedView.CurrentDock) { SetViewDock(parentTabbedView, parentTabbedView.HostContainerDock, parentDock, parentTabbedView.CurrentDockMode); } parentDock = parentTabbedView.HostContainerDock; } UpdateViewButtons(parentTabbedView); if (dock != DockStyle.Fill) { SetViewDock(formTabbedView, parentDock, dock, parentTabbedView.CurrentDockMode); } }
/// <summary> /// Remove the container /// </summary> /// <param name="container">container to remove</param> private void RemoveContainer(DockingContainer container) { Debug.Assert(container.Parent != null, "Docked container must be hosted somewere"); container.SetModeEmpty(); DockingContainer containerParent = container.Parent as DockingContainer; if (containerParent == null) { Debug.Assert(container.Parent.Handle == _host.Handle, "Parents of FormsTabbedView should be only DockingContainer or _host"); } else { DockingContainer 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) { DockingContainer leftPane = otherContainer.LeftPane; DockingContainer rightPane = otherContainer.RightPane; otherContainer.SetModeEmpty(); containerParent.SetModeHSplit(leftPane, rightPane); } else if (otherContainer.TopPane != null) { DockingContainer topPane = otherContainer.TopPane; DockingContainer 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, DockableMode.None); } } otherContainer.Parent = null; otherContainer.Splitter.Parent = null; otherContainer.Dispose(); } container.Parent = null; container.Splitter.Parent = null; container.Dispose(); }