Resize Event -- Event Procedures

Description

To create an event procedure that is executed when the Resize event occurs, set the OnResize property to [Event Procedure], and click the Build button.

Syntax

Private Sub Form_Resize( )

Remarks

To repaint the screen every time a form is resized, use the Repaint method in a Resize event procedure.

You can’t cancel the Resize event.

See Also

Resize Event — Macros.

Example

The following example shows how a Resize event procedure can be used to repaint a form when it is maximized. When the user clicks a command button labeled “Maximize,” the form is maximized and the Resize event is triggered.

To try this example, add the code to the Declarations section of a module for a form called Contacts that contains a command button named Maximize.


Private Sub Maximize_Click()
    DoCmd.MaximizeSub
Sub Form_Resize()
    Forms!Contacts.RepaintSub