Category / Section
How to adjust the WinForms Docking Manager control size based on the parent form size?
1 min read
Size
In DockingManager, you can adjust the docked control size based on the parent form size, by handling its parent form resize event. And you can set the default size of the docked control by using SetControlSize method. The following code example illustrates the same.
C#
//Initialize the size Size minimumsize = new Size(200, 200); void Form1_Resize(object sender, EventArgs e) { //Set the minimum size for the docked control this.dockingManager1.SetControlSize(this.panel1, minimumsize); this.dockingManager1.SetControlSize(this.panel2, minimumsize); }
VB
'Initialize the size Private dock_MinimumSize As New Size(200, 200) Private Sub Form1_Resize(ByVal sender As Object, ByVal e As EventArgs) 'Set the minimum size for the docked control Me.dockingManager1.SetControlSize(Me.panel1, dock_MinimumSize) Me.dockingManager1.SetControlSize(Me.panel2, dock_MinimumSize) End Sub
Sample:
https://www.syncfusion.com/downloads/support/directtrac/general/Docking_Resize930423350.zip
UG document link: https://help.syncfusion.com/windowsforms/dockingmanager/dealing-with-docking-child#set-size-for-docking-children