internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane) { if (!this.IsSuspendSetDockState) { if ((this.DockPanel == null) && (visibleState != DockState.Unknown)) { throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_NullPanel); } if ((visibleState == DockState.Hidden) || ((visibleState != DockState.Unknown) && !this.IsDockStateValid(visibleState))) { throw new InvalidOperationException(Strings.DockContentHandler_SetDockState_InvalidState); } DockPanel dockPanel = this.DockPanel; if (dockPanel != null) { dockPanel.SuspendLayout(true); } this.SuspendSetDockState(); DockState dockState = this.DockState; if ((this.m_isHidden != isHidden) || (dockState == DockState.Unknown)) { this.m_isHidden = isHidden; } this.m_visibleState = visibleState; this.m_dockState = isHidden ? DockState.Hidden : visibleState; if (visibleState == DockState.Unknown) { this.Pane = null; } else { this.m_isFloat = this.m_visibleState == DockState.Float; if (this.Pane == null) { this.Pane = this.DockPanel.DockPaneFactory.CreateDockPane(this.Content, visibleState, true); } else if (this.Pane.DockState != visibleState) { if (this.Pane.Contents.Count == 1) { this.Pane.SetDockState(visibleState); } else { this.Pane = this.DockPanel.DockPaneFactory.CreateDockPane(this.Content, visibleState, true); } } } if (this.Form.ContainsFocus && ((this.DockState == DockState.Hidden) || (this.DockState == DockState.Unknown))) { this.DockPanel.ContentFocusManager.GiveUpFocus(this.Content); } this.SetPaneAndVisible(this.Pane); if (((oldPane != null) && !oldPane.IsDisposed) && (dockState == oldPane.DockState)) { RefreshDockPane(oldPane); } if (((this.Pane != null) && (this.DockState == this.Pane.DockState)) && ((this.Pane != oldPane) || ((this.Pane == oldPane) && (dockState != oldPane.DockState)))) { RefreshDockPane(this.Pane); } if (dockState != this.DockState) { if (((this.DockState == DockState.Hidden) || (this.DockState == DockState.Unknown)) || DockHelper.IsDockStateAutoHide(this.DockState)) { this.DockPanel.ContentFocusManager.RemoveFromList(this.Content); } else { this.DockPanel.ContentFocusManager.AddToList(this.Content); } this.OnDockStateChanged(EventArgs.Empty); } this.ResumeSetDockState(); if (dockPanel != null) { dockPanel.ResumeLayout(true, true); } } }
private void AutoHide_Click(object sender, EventArgs e) { base.DockPane.DockState = DockHelper.ToggleAutoHideState(base.DockPane.DockState); }