Articles in this section
Category / Section

How to close a docked control programmatically in WinForms Docking Manager?

1 min read

Closing a docked control

When a docked control is closed, its visibility is set to false and not actually closed. The docked control''s object will be disposed when the parent form is closed only. So docked control can be programmatically closed using SetDockVisibility() method.


private void closePanelToolStripMenuItem_Click(object sender, EventArgs e)
  this.dockingManager1.SetDockVisibility(this.panel1, false);
private void showPanelToolStripMenuItem_Click(object sender, EventArgs e)
  this.dockingManager1.SetDockVisibility(this.panel1, true);



Private Sub closePanelToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles closePanelToolStripMenuItem.Click
  Me.dockingManager1.SetDockVisibility(Me.panel1, False)
End Sub
Private Sub showPanelToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs) Handles showPanelToolStripMenuItem.Click
  Me.dockingManager1.SetDockVisibility(Me.panel1, True)
End Sub


UG document link:

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment