Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

What are Docking & Anchor?

Dock and anchor concepts apply to the default layout used for Forms. Simply put, anchor maintains the distance between the edge of the control and the corresponding edge of the container in which it is anchored. By default, controls are anchored top left – this is what keeps them in the same place when a form is resized. I'll leave anchor=none as an exercise in mind expansion for the ready. Dock and anchor are closely related – in fact dock is a subset of the anchor where the distance from the corresponding anchored sides are zero.

Dock -> Anchor Mapping

Dock

Anchor

None

None

Top

Top, Left, Right

Bottom

Bottom, Left, Right

Left

Top, Bottom, Left

Right

Top, Bottom, Right

Fill

Top, Bottom, Left, Right



Page view counter