Vcl.Graphics.TCustomCanvas.TextExtent

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function TextExtent(const Text: string): TSize; virtual; abstract;

C++

virtual System::Types::TSize __fastcall TextExtent(const System::UnicodeString Text) = 0 ;

Properties

Type Visibility Source Unit Parent
function public
Vcl.Graphics.pas
Vcl.Graphics.hpp
Vcl.Graphics TCustomCanvas

Description

Returns the width and height, in pixels, of a string rendered in the current font.

Override the TextExtent method to provide the information about the space a string will occupy in the image. Other elements in the image such as lines, boxes, or additional lines of text can be positioned to accommodate the size of the text. TextExtent returns the width and height of the rectangle that bounds the text on the canvas.

Both the TextHeight and TextWidth methods call TextExtent to obtain the height and width information.

See Also