Automatically Controlling a Control’s Size and Position

Before starting our discussion of specific controls, we will examine two properties that assist with managing the position and sizing of controls on forms. These properties apply to a large number of controls, including the basic controls discussed in Chapter 11.

The Anchor and Dock properties manage the position and sizing of controls as the user changes the size of a form. These two properties are examined in the following sections.

Anchoring Controls

When you place a control on a form, its position on the form is specified by setting its Location property, which defines the distance from the left edge of the form to the left edge of the control (the X subproperty) and the distance from ...

Get Special Edition Using Microsoft® Visual Basic® .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.