TBitmap32.TextOut

procedure TextOut(X, Y: Integer; const Text: String); overload;

procedure TextOutW(X, Y: Integer; const Text: Widestring); overload;

 

procedure TextOut(X, Y: Integer; const ClipRect: TRect; const Text: String); overload;

procedure TextOutW(X, Y: Integer; const ClipRect: TRect; const Text: Widestring); overload;

 

procedure TextOut(DstRect: TRect; const Flags: Cardinal; const Text: String); overload;

procedure TextOutW(DstRect: TRect; const Flags: Cardinal; const Text: Widestring); overload;

Description

Use TextOut or TextOutW (the Unicode version) to write a string onto the bitmap. The string will be written using current Font.

Use the TextExtent method to determine the space occupied by the text in the image. TextOut does not support transparent text colors.

The second version performs clipping of a text to the ClipRect rectangle.

The last version provides the most flexible text formatting. See description of DrawText function in 'Win32 Developer Reference' help file for information on Flags and their function.

Special Note for CLX users:

Since CLX is based on the QT library rather than the native Win API the flags used in the last two functions are somewhat different from the Win32 flags. You can get more information on the QT specific flags here and here. However, to make it easier for you, we have provided some basic mappings that will work in QT just as their Win API counterparts:

DT_LEFT, DT_RIGHT, DT_TOP, DT_BOTTOM, DT_CENTER, DT_VCENTER, DT_EXPANDTABS, DT_NOCLIP, DT_WORDBREAK, DT_SINGLELINE

However, the following flags are missing because there is no equivalent value in QT at this time:

DT_CALCRECT, DT_EDITCONTOL, DT_END_ELLIPSIS and DT_PATH_ELLIPSIS, DT_EXTERNALLEADING, DT_MODIFYSTRING, DT_NOPREFIX, DT_RTLREADING, DT_TABSTOP


Please note that the CLX versions of the non-Unicode methods do also default to Widestring because that is the native QT string format.

See Also

RenderText, TextExtent, TextHeight, TextWidth, Font, Rectangle Types