You can dock controls to the edges of your form or have them fill the control's container (either a form or a container control). For example, Windows Explorer docks its TreeView control to the left side of the window and its ListView control to the right side of the window. Use the Dock property for all visible Win Forms controls to define the docking mode.
To dock a control on a form at run time
[Visual Basic] Private Sub DockMyControl() 'Set the TreeView control' to anchor to left. trvMain.Dock = DockStyle.Left End Sub [C#] private void DockMyControl() { ' Set the TreeView control' to anchor to left. trvMain.Dock = DockStyle.Left; }
When your form is displayed at run time, the control resizes to the size of the borders the control is docked to.
Control Manipulation on Win Forms | Controls by Category | Resizing Controls on Win Forms | Setting the Tab Order on Win Forms | Working with Individual Controls | Controls You can Use on Win Forms | Control Technologies and Where to Use Them | Win Form Controls by Function