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

TCustomSpeedButton.GetTextSize

Gets the size of the text within the specified PaintRect.

Declaration

Source position: buttons.pp line 399

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.

GetTextSize removes Ampersand (&) characters in Caption prior to calculating the dimensions for the text using the TextStyle for the control Canvas. The value in PaintRect is updated with the calculated dimensions. The X and Y members in the return value contain the Width and the height for the text using the Font for the control. Both member values are set to 0 when ShowCaption is False or Caption contains an empty string ('').

GetTextSize is called from the MeasureDraw method.

See also

TCustomSpeedButton.MeasureDraw

  

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

TCustomSpeedButton.ShowCaption

  

Indicates if the Caption for the speed button is displayed.

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.