Align Property

See AlsoBZZAI3                 ExampleCD1QR0>Low

Applies To

Picture box31MYIWX.


Determines whether a picture box can appear in any size anywhere on a form, or whether it appears at the top or bottom of the form automatically sized to fit the form's width.


[form.]picturebox.Align[ = numericexpression ]


The Align property settings are:

Setting             Description


0                     (Default in a non-MDI form) Nonesize and location can be set at design time or in code.  This setting is ignored if the picture box is on an MDI form.

1                     (Default in an MDI form) Toppicture box is at the top of the form and its width is equal to the form's ScaleWidth3J8U7ZN property setting.

2                     Bottompicture box is at the bottom 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 users change the size of the form, a picture box with Align set to 1 or 2 automatically resizes to fit the width of the form.

A picture box is the only standard control that can be placed on an MDI form.  The client areaFXH476 of an MDI form is defined by the space not covered by picture boxes.  When an MDI child form is maximized within the parent MDI form, it will not cover any picture boxes.

Data Type


See Also


Using MDI FeaturesHOWMDI

ScaleHeight, ScaleWidth Properties3J8U7ZN


Programmer's Guide:

Chapter 14, "Multiple-Document Interface (MDI) Applications"

Align Property Example

The example uses a picture box as a toolbar on an MDI form, with a command button to move the picture box from the top to the bottom of the form.  To try this example, create a new MDI form and set the MDIChild property of the other form to True.  Draw a picture box and put a command button on the picture box.  Paste the code into the Declarations section of Form1 and then press F5.

Sub Command1_Click ()
  If Picture1.Align = 1 Then
    Picture1.Align = 2       ' Align to bottom of form.
    Picture1.Align = 1       ' Align to top of form.
  End If
End Sub