Skip to main content
Pie
ra0

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCanvas.TextExtent(string,TRect,Integer) Method

Returns the dimensions of a text string at the canvas font settings.

#Declaration

Delphi
procedure TextExtent(const Text: string; var R: TRect; Flags: Integer); overload;

#Parameters

Name Type
Text string
R TRect
Flags Integer

#Remarks

Call either of the overloaded TextExtent methods to identify a text string’s dimensions when it is drawn at the current Font settings. This is useful if you need to adjust UI element sizes and positions according to the text size.

The TextExtent function returns the pixel width and height of the specified string when the TextOut procedure draws it.

The TextExtent procedure is designed to work together with the overloaded DrawTexT procedures. This TextExtent variant returns the rectangle (R) that the drawn text would occupy with all text draw flags applied (Flags) at the current Font settings. Refer to the DrawTexT procedure description for detailed information on available flags.

See Also