[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# TControl.OnResize

Event Handler for resize of control

## Declaration

Source position: controls.pp line 1397

`public property TControl.OnResize: TNotifyEvent read FOnResize write FOnResize;`

## Description

This event is triggered whenever the Width, Height, ClientWidth or ClientHeight of the control has changed. During autosize the size can change multiple times and only the last change triggers the OnResize. Use OnResize to react to resizes or to put your custom aligning, positioning code into this. To react to moves use the OnChangeBounds event.

Common mistake: Keep in mind that ClientWidth and ClientHeight can change even when Width, Height stays the same. For example when the theme or the font changes the Width, Height of a TForm, TGroupBox, TPageControl stays, but the frame changes and thus the ClientWidth, ClientHeight too. This does not happen that often under windows, but it happens quite often on other platforms.

Especially it is not sufficient to write only a TForm.OnResize handler to resize all controls on the form. This is a common bug in Delphi applications.

## See also

#rtl.Classes.TNotifyEvent

The latest version of this document can be found at lazarus-ccr.sourceforge.net .