Occurs when an object is first displayed or when the window state of an object changes. (For example, a form is maximized, minimized, or restored.)
Private Sub Form_Resize()
Private Sub object_Resize(height, width)
The Resize event syntax has these parts:
Part | Description |
---|---|
object | An object expression that evaluates to an object. |
height | Number specifying the new height of the control. |
width | Number specifying the new width of the control. |
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, invoke the Paint event by using the Refresh method in a Resize event procedure.
Whenever the AutoRedraw property is set to False and the form is resized, Visual Basic also calls the related events, Resize and Paint, in that order. When you attach procedures for these related events, be sure their actions do not conflict.