Home > Language Reference > Classes > UserControl

Resize Event

Event raised when the control is resized.

Syntax

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

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

Remarks

The Resize event is sent first just after the control is loaded, and then each time it is resized. This can occurs either because of the user opening and closing the dynamic input area, or either because of calling the Move method programmatically.

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

This event is typically used to allocated a bitmap for double-buffering. For example:

Private bm As New Bitmap

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

Private Sub UserControl_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 control initialization.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A