Left, Top Properties Example

This example sets the size of a form to 75 percent of screen size and centers the form when it's loaded. To try this example, paste the code into the Declarations section of a form, and then press F5 and click the form.

Private Sub Form_Click ()
   Width = Screen.Width * .75   ' Set width of form.
   Height = Screen.Height * .75   ' Set height of form.
   Left = (Screen.Width - Width) / 2   ' Center form horizontally.
   Top = (Screen.Height - Height) / 2   ' Center form vertically.
End Sub