Visual Basic Reference
Returns or sets a value that determines whether an object is displayed in any size anywhere on a form or whether it's displayed at the top, bottom, left, or right of the form and is automatically sized to fit the form's width.
object.Align [= number]
The Align property syntax has these parts:
|Object||An object expression that evaluates to an object in the Applies To list.|
|Number||An integer that specifies how an object is displayed, as described in Settings.|
The settings for number are:
|VbAlignNone||0||(Default in a non-MDI form) None size and location can be set at design time or in code. This setting is ignored if the object is on an MDI form.|
|VbAlignTop||1||(Default in an MDI form) Top object is at the top of the form, and its width is equal to the form's ScaleWidth property setting.|
|VbAlignBottom||2||Bottom object is at the bottom of the form, and its width is equal to the form's ScaleWidth property setting.|
|VbAlignLeft||3||Left object is at the left of the form, and its width is equal to the form's ScaleWidth property setting.|
|VbAlignRight||4||Right object is at the right of the form, and its width is equal to the form's ScaleWidth property setting.|
You can use the Align property to quickly create a toolbar or status bar at the top or bottom of a form. As a user changes the size of the form, an object with Align set to 1 or 2 automatically resizes to fit the width of the form.
PictureBox and Data controls are the only standard controls that can be placed on an MDI form. The internal area of an MDI form is defined by the space not covered by controls. When an MDI child form is maximized within the parent MDI form, it won't cover any controls.
Use number settings 3 and 4 to align toolbars at the left and right sides of a form or MDI form. If there are two toolbars in a corner of an MDI form, the top- or bottom-aligned one extends to the corner, taking precedence over the left- or right-aligned one. Left- and right-aligned objects occupy the internal area on an MDI form, just like top- and bottom-aligned objects.