Category / Section
How to remove the control from WinForms Docking Manager control collection?
1 min read
Removing a control from DockingManager collection
We can use SetEnableDocking() method inside DockVisibilityChanged event to remove the control from dockingManager controls collection. SetEnableDocking(control , false) removes a control from DockingManager. The following code snippet illustrates this.
C#
void dockingManager1_DockVisibilityChanged(object sender, DockVisibilityChangedEventArgs arg) { this.dockingManager1.SetEnableDocking(arg.Control, false); arg.Control.Dispose(); }
VB
Private Sub dockingManager1_DockVisibilityChanged(ByVal sender As Object, ByVal arg As DockVisibilityChangedEventArgs) Me.dockingManager1.SetEnableDocking(arg.Control, False) arg.Control.Dispose() End Sub
UG document links: