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

TCustomSpeedButton.GetTextSize

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

Declaration

Source position: buttons.pp line 402

protected function TCustomSpeedButton.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

TCustomSpeedButton.ShowCaption

  

Indicates if the Caption for the speed button is displayed.

TCustomSpeedButton.MeasureDraw

  

Calculates the Width, Height, and layout for the speed button and optionally renders the control.

TGraphicControl.Canvas

  

A clipped window into the parent Canvas.

TControl.Caption

  

The text displayed for the control.

TControl.Font

  

The font to be used for text display in this control.


Version 3.2 Generated 2024-02-25 Home