ReSize and Moved Event

Purpose

The ReSize event occurs when the window state of a Form changes. (For example, a form is maximized, minimized, or restored.)

The Moved event occurs when a Form is moved or being moved to a new position or a Form's Top or Left property settings have been changed programmatically.

Syntax

Sub Form_Resize( [index%] )

Sub Form_Moved( [index%] )

index%:iexp, Form number

Description

These events occurs when an object is sized, (being) moved to a new position, or when the settings for the Top, Left, Width, or Height properties have been changed in code.

Example

Debug.Show

OpenW 1, 10, 10, 300, 300

Do

Sleep

Until Win_1 Is Nothing

 

Sub Win_1_ReSize

Debug "Resize"

 

Sub Win_1_Paint

Debug "Paint"

 

Sub Win_1_Moved

Debug Me.Left' in twips

Debug Me.Top' in twips

Remarks

Use a ReSize event procedure to move or resize controls when the parent form is resized. You can also use this event procedure to recalculate variables or properties, such as ScaleHeight and ScaleWidth that may depend on the size of the form. If you want graphics to maintain sizes proportional to the form when it's resized, use the Paint event, which follows the ReSize event.

For a Form, the Left and Top properties are in twips. For Ocx controls in the client the new cooridnates are in ScaleMode units if OcxScale = 1.

See Also

Form

{Created by Sjouke Hamstra; Last updated: 22/10/2014 by James Gaite}