Visual Basic Reference

Align Property Example

This example uses a PictureBox control as a toolbar on an MDIForm object, with a CommandButton control to move the PictureBox from the top to the bottom of the form. To try this example, create a new MDIForm and set the MDIChild property of Form1 to True. Draw a PictureBox on the MDIForm, and put a CommandButton on the PictureBox. Paste the code into the Declarations section of the MDIForm, and then press F5. Click the CommandButton to move the PictureBox.

  Private Sub Command1_Click ()
   If Picture1.Align = vbAlignTop Then
      Picture1.Align = vbAlignBottom
  ' Align to bottom of form.
   Else
      Picture1.Align = vbAlignTop     
  ' Align to top of form.
   End If
End Sub