Home > Language Reference > Classes > Form

Resize Event

Event raised when the form is resized.

Syntax

Protected Event Resize(ByVal iWidth As Integer, ByVal iHeight As Integer)

ParameterDescription
iWidthNew width of the form, expressed in standard coordinates.
iHeightNew height of the form, expressed in standard coordinates.

Remarks

The Resize event is sent first just after the form is loaded, and then each time it is resized. Currently, only opening or closing the dynamic input area can cause a form to be resized; however, this could also be achieve in a future HB++ release by calling the Move method.

The iWidth and iHeight parameters passed along with the event respectively contain the new width and height of the form, expressed in standard coordinates.

This event is typically used to change the layout of a form by moving and resizing controls. It can also be used to allocated a bitmap for double-buffering. For example:

Private bm As New Bitmap

Private Sub Form_Resize(ByVal iWidth As Integer, ByVal iHeight As Integer)
  bm.Create iWidth, iHeight
  DrawIntoTheBitmap
End Sub

Private Sub Form_Paint()
  CopyArea 0,0,bm.Width,bm.Height,bm,0,0
End Sub

Private Sub DrawIntoTheBitmap()
  ...
End Sub

Note that initializing the double-buffering bitmap from the Load event handler is now useless, since the Resize event is always sent at least once during the form initialization.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0-
Windows CEWindows CE 3.0-