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

# TWidgetSet.DrawText

Draws formatted text within a rectangle.

## Declaration

Source position: winapih.inc line 85

`public function TWidgetSet.DrawText(`
`DC: HDC;`
`Str: PChar;`
`Count: Integer;`
`var Rect: TRect;`
`Flags: Cardinal`
`):Integer; virtual;`

## Arguments

`DC` |  | Device context for the text rendering operation.
`Str` |  | The text (should be zero terminated).
`Count` |  | The number of (Wide)Chars in the text.
`Rect` |  | The bounding (clipping) rectangle.
`Flags` |  | Formatting flags applied in the method.

## Function result

The height for the rendered text, calculated from values in Rect. Zero on failure.

## Description

Several formatting options are available for use in the Flags argument. The value correspond to the DrawText constants defined in the lcltype.pp unit.

DT_CALCRECT suppresses all painting, and calculates the extent for the formatted text returned in the Rect parameter.