The Dock property allows you to attach a control to the edge of its parent. For example, a control docked to the top edge of a form or container control will always be connected to the top edge of the parent control and will automatically resize in the left and right directions when its parent is resized. The Dock property can also be set to Fill, in which case, the control will grow to occupy all of the available space in the parent control. This setting is usually used with a container control, such as Split-Container or FlowLayoutPanel.
Like the Anchor property, the Dock property provides a graphical interface for setting the value, as shown in Figure 2-9.
Was this article helpful?