private void ShowControl(DockingControl control) { Form parentForm = this.ParentForm; using (RedrawStopper stopRedraws = new RedrawStopper(parentForm)) { Manager.SuspendLayout(); switch (this.Dock) { case DockStyle.Left: case DockStyle.Right: this.Width = Math.Max(this.Width, PaddingWidth + control.Width); break; case DockStyle.Top: case DockStyle.Bottom: this.Height = Math.Max(this.Height, PaddingWidth + control.Height); break; } this.Visible = true; control.Parent = this; ToolStripButton button = _mapDockingControlToData[control].Button; if (button != null) { _menuStrip.Items.Remove(button); AutoResizeControl autoResizeControl = _mapButtonToControl[button]; this.Controls.Remove(autoResizeControl); autoResizeControl.Dispose(); _mapButtonToControl.Remove(button); } DockingControlData oldData = _mapDockingControlToData[control]; _mapDockingControlToData[control] = new DockingControlData(null, oldData.AutoHideChangedHandler, oldData.CancelledChangedHandler); if (ToolStripHelpers.GetVisibleButtonCount(_menuStrip) == 0) { _menuStrip.Visible = false; } _dockingControls.Remove(control); _dockingControls.Add(control); OnDockingControlAutoHide(control); if (control.Cancelled) { CancelControl(control); } Manager.ResumeLayout(true); control.DraggingEnabled = true; } control.Focus(); control.Select(); if (parentForm != null) { parentForm.Invalidate(true); } }