DrawRotatedText procedure
Draws the provided text on the given canvas, rotated by an angle as
specified by the canvas'
Font.Orientation. Returns the smallest
enclosing rectangle.
Declaration
procedure DrawRotatedText(ACanvas: TCanvas; AText: string;
AFlags: Integer; AMaxLineLength: Integer;
var ARect: TRect)Arguments
ACanvas | ACanvas (type
TCanvas) identifies the canvas on which
the text is painted. |
AText | String parameter which defines the input text to be painted. |
AFlags | Integer parameter containing a bitmask with miscellaneous drawing options |
AMaxLineLength | Integer parameter defining the maximum length (in pixels) that a line
can have before word-wrapping. Only used when the
|
ARect | Defines the rectangle in which the text is painted. After drawing, its width and height are modified such that the text is tightly enclosed. |
Description
The procedure DrawRotatedText draws the text given in the parameter
AText on the provided canvas (ACanvas). The text is rotated
by an angle derived from the canvas'
Font.Orientation property (which is specified in units of 1/10 degree).
When the input text contains LineEnding marks the individual lines
are wrapped and drawn correctly even when rotated.
The line endings, however, are ignored when the AFlags parameter
contains the bit flag DT_SINGLELINE.
When the AFlags parameter contains the bit flag DT_WORDBREAK
the text is wrapped to separate lines which are not longer than the given
AMaxLineLength pixel count.
The parameter ARect of type TRect identifies the
rectangle in which the text is to be painted. After painting
(or when the AFlags parameter contains the bit flag DT_CALCRECT
the width and height of the rectangle are adjusted so that the rectangle encloses
the text tightly.
Other bit options provided by the AFlags argument are
-
DT_LEFT, DT_RIGHT, DT_CENTER-- the individual lines are left-aligned/right-aligned/centered within the drawing rectangleARect. -
DT_TOP, DT_BOTTOM, DT_VCENTER-- the text block is top-aligned/bottom-aligned/vertically centered within the drawing rectangleARect. -
DT_RTLREADING-- the text is drawn from right to left as used in mid-east countries. Left and right alignments are exchanged. -
DT_CALCRECT-- Nothing is drawn, only the size of the enclosing rectangle is calculated and returned. -
DT_NOPREFIX-- Displays the accelerator character '&'. Not supported by rotated text. -
DT_EXPANDTABS-- Expands tab characters (#9). Not supported by rotated text.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
