Sign in Join
FPDoc Onlineexperiment

TCustomSpeedButton.GetTextSize function

Member of TCustomSpeedButtonprotectedIn unit Buttons

Gets the size of the Caption text within the specified PaintRect.

Declaration

pascal
function GetTextSize(Drawing: Boolean; PaintRect: TRect): TSize
 ; virtual

Arguments

Drawing

Not used in the current implementation.

PaintRect

Display rectangle for the control; updated in the method with the calculated text dimensions.

Function result

TSize instance with the dimensions for the caption text.

Description

GetTextSize is a TSize function used to get the dimensions for the Caption text for the control. It calculates the dimensions for the text using the TextStyle and Font assigned to the control Canvas.

The return value is a TSize instance where the CX and CY members represent the width and height for the text. The DrawText routine in the LCL interface is called to calculate the dimensions using the text style, flags, and the PaintRect for the control. The coordinates from the updated PaintRect are stored in CX and CY in the return value. Both members are set to 0 when ShowCaption is False or Caption contains an empty string ('').

GetTextSize is called from the MeasureDraw method.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.