TcxCanvas.TextExtent(string,TRect,Integer) Method
Returns the dimensions of a text string at the canvas font settings.
Declaration
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.