Left, Top Properties
See Also Example
Form, MDI form, check box , combo box , command button , common dialog, data control , directory list box , drive list box , file list box , frame , grid , horizontal scroll bar , image , label , list box , OLE control , option button , picture box , shape , text box , timer , vertical scroll bar .
Leftdetermines the distance between the internal left edge of an object and the left edge of its container .
Topdetermines the distance between the internal top edge of an object and the top edge of its container.
For a form, the Left and Top properties are always expressed in twips The values for these properties change as the object is moved by the user or by code. For a timer, these properties are not available at run time.; for a control, they are measured in units according to the coordinate system of its container.
[form.][control.]Left[ = x ]
[form.][control.]Top[ = y ]
For both properties, you can specify a single-precision number.
Use Left and Top, and the Height and Width Use the ScaleLeft , ScaleTop , ScaleHeight , and ScaleWidth properties for operations based on an object's internal dimensions, such as drawing or moving objects that are contained within the object. The scale-related properties apply only to forms, picture boxes, and the Printer object . properties, for operations based on an object's external dimensions, such as moving or resizing.
ScaleHeight, ScaleWidth Properties
ScaleLeft, ScaleTop Properties
Chapter 15, "Creating Graphics for Applications"
Left, Top Properties Example
The example sets the size of a form to 75% of screen size, and centers the form when it is loaded. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Width = Screen.Width * .75 ' Set height of form.
Height = Screen.Height * .75 ' Set width of form.
Left = (Screen.Width - Width) / 2 ' Center form horizontally.
Top = (Screen.Height - Height) / 2 ' Center form vertically.