Center Method (AForm)

Centers the form object on the given window.

Syntax

Object.Center ( [IHWnd] )

The Center method syntax has the following parts:

 

Name

Type

Description

Object

AForm

AForm object

lHWnd

Val Variant

An integer specifying the handle of the control in the window.

Comments

If lHWnd is not specified, the form will be centered within the screen. If lHWnd is equal to 0, the form will be centered within its parent. Otherwise, the form will be centered within the window specified by lHWnd. By default when a form is loaded its position is calculated according to the Form Left and Top and StartupPosition properties.

Call this method in the form OnLoad event to center the form before its being displayed.

Example

The following statement centers the AForm on the screen:

frmMain.Center()

Applies to

AForm

See Also

Left, ScaleX, ScaleY, StartupPosition, Top