Table of Contents

TTMSFNCGraphics.DrawText Method

Renders AText at a single floating-point point, optionally rotated by AAngle degrees.

API unit family: TMSFNCGraphics Declaring type: TTMSFNCGraphics

Overloads

Overload 1

Renders AText at a single floating-point point, optionally rotated by AAngle degrees.

function DrawText(APoint: TPointF; AText: String; AAngle: Single = 0 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
APoint Top-left position at which the text is drawn.
AText Text string to render.
AAngle Rotation angle in degrees, applied clockwise. Default is 0.
ASupportHTML When True, interprets HTML tags in the text. Default is True.
ATestAnchor When True, tests whether the point (AX, AY) is over an HTML anchor. Default is False.
AX X coordinate used for anchor hit-testing when ATestAnchor is True. Default is -1 (disabled).
AY Y coordinate used for anchor hit-testing when ATestAnchor is True. Default is -1 (disabled).

Returns

The href of the HTML anchor at (AX, AY), or an empty string if no anchor was hit.

Overload 2

Renders AText inside a TRectF with the specified alignment, trimming, and optional rotation.

function DrawText(ARect: TRectF; AText: String; AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ARect Bounding rectangle within which the text is rendered.
AText Text string to render.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment of the text within the rectangle. Default is gtaLeading.
AVerticalAlign Vertical alignment of the text within the rectangle. Default is gtaCenter.
ATrimming Text trimming mode applied when the text overflows. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width; pass -1 to use the rectangle width. Default is -1.
AMinHeight Minimum rendering height; pass -1 to use the rectangle height. Default is -1.
ASupportHTML When True, interprets HTML tags in the text. Default is True.
ATestAnchor When True, tests whether (AX, AY) is over an HTML anchor. Default is False.
AX X coordinate for anchor hit-testing. Default is -1 (disabled).
AY Y coordinate for anchor hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at (AX, AY), or an empty string if no anchor was hit.

Overload 3

Renders AText inside a double-coordinate bounding box with the specified alignment and trimming.

function DrawText(ALeft, ATop, ARight, ABottom: Double; AText: String; AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ALeft Left edge of the bounding box in floating-point pixels.
ATop Top edge of the bounding box in floating-point pixels.
ARight Right edge of the bounding box in floating-point pixels.
ABottom Bottom edge of the bounding box in floating-point pixels.
AText Text string to render.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment within the bounding box. Default is gtaLeading.
AVerticalAlign Vertical alignment within the bounding box. Default is gtaCenter.
ATrimming Text trimming mode applied when the text overflows. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width. Default is -1 (use box width).
AMinHeight Minimum rendering height. Default is -1 (use box height).
ASupportHTML When True, interprets HTML tags in the text. Default is True.
ATestAnchor When True, tests whether (AX, AY) is over an HTML anchor. Default is False.
AX X coordinate for anchor hit-testing. Default is -1 (disabled).
AY Y coordinate for anchor hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at (AX, AY), or an empty string if no anchor was hit.

Overload 4

Renders AText inside a TRect with the specified alignment and trimming.

function DrawText(ARect: TRect; AText: String; AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ARect Bounding rectangle in integer pixels within which the text is rendered.
AText Text string to render.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment within the rectangle. Default is gtaLeading.
AVerticalAlign Vertical alignment within the rectangle. Default is gtaCenter.
ATrimming Text trimming mode applied when the text overflows. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width. Default is -1 (use rectangle width).
AMinHeight Minimum rendering height. Default is -1 (use rectangle height).
ASupportHTML When True, interprets HTML tags in the text. Default is True.
ATestAnchor When True, tests whether (AX, AY) is over an HTML anchor. Default is False.
AX X coordinate for anchor hit-testing. Default is -1 (disabled).
AY Y coordinate for anchor hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at (AX, AY), or an empty string if no anchor was hit.

Overload 5

Renders AText inside an integer-coordinate bounding box with the specified alignment and trimming.

function DrawText(ALeft, ATop, ARight, ABottom: Integer; AText: String; AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ALeft Left edge of the bounding box in integer pixels.
ATop Top edge of the bounding box in integer pixels.
ARight Right edge of the bounding box in integer pixels.
ABottom Bottom edge of the bounding box in integer pixels.
AText Text string to render.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment within the bounding box. Default is gtaLeading.
AVerticalAlign Vertical alignment within the bounding box. Default is gtaCenter.
ATrimming Text trimming mode applied when the text overflows. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width. Default is -1 (use box width).
AMinHeight Minimum rendering height. Default is -1 (use box height).
ASupportHTML When True, interprets HTML tags in the text. Default is True.
ATestAnchor When True, tests whether (AX, AY) is over an HTML anchor. Default is False.
AX X coordinate for anchor hit-testing. Default is -1 (disabled).
AY Y coordinate for anchor hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at (AX, AY), or an empty string if no anchor was hit.

Overload 6

Renders AText inside a TRectF and also returns the ID, value, and type of any interactive HTML control element at the test position.

function DrawText(ARect: TRectF; AText: String; var AControlID: String; var AControlValue: String; var AControlType: string;AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ARect Bounding rectangle within which the text is rendered.
AText Text string to render.
AControlID Receives the id attribute of any HTML input control at the test position.
AControlValue Receives the current value of any HTML input control at the test position.
AControlType Receives the element type of any HTML input control at the test position.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment within the rectangle. Default is gtaLeading.
AVerticalAlign Vertical alignment within the rectangle. Default is gtaCenter.
ATrimming Text trimming mode. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width. Default is -1.
AMinHeight Minimum rendering height. Default is -1.
ASupportHTML When True, interprets HTML tags. Default is True.
ATestAnchor When True, performs hit-testing at (AX, AY). Default is False.
AX X coordinate for anchor/control hit-testing. Default is -1 (disabled).
AY Y coordinate for anchor/control hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at the test position, or an empty string if none.

Overload 7

Renders AText inside a double-coordinate bounding box and also returns the ID, value, and type of any interactive HTML control element at the test position.

function DrawText(ALeft, ATop, ARight, ABottom: Double; AText: String; var AControlID: String; var AControlValue: String; var AControlType: string; AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ALeft Left edge of the bounding box in floating-point pixels.
ATop Top edge of the bounding box in floating-point pixels.
ARight Right edge of the bounding box in floating-point pixels.
ABottom Bottom edge of the bounding box in floating-point pixels.
AText Text string to render.
AControlID Receives the id attribute of any HTML input control at the test position.
AControlValue Receives the current value of any HTML input control at the test position.
AControlType Receives the element type of any HTML input control at the test position.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment. Default is gtaLeading.
AVerticalAlign Vertical alignment. Default is gtaCenter.
ATrimming Text trimming mode. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width. Default is -1.
AMinHeight Minimum rendering height. Default is -1.
ASupportHTML When True, interprets HTML tags. Default is True.
ATestAnchor When True, performs hit-testing. Default is False.
AX X coordinate for hit-testing. Default is -1 (disabled).
AY Y coordinate for hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at the test position, or an empty string if none.

Overload 8

Renders AText inside a TRect and also returns the ID, value, and type of any interactive HTML control element at the test position.

function DrawText(ARect: TRect; AText: String; var AControlID: String; var AControlValue: String; var AControlType: string; AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ARect Bounding rectangle in integer pixels within which the text is rendered.
AText Text string to render.
AControlID Receives the id attribute of any HTML input control at the test position.
AControlValue Receives the current value of any HTML input control at the test position.
AControlType Receives the element type of any HTML input control at the test position.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment. Default is gtaLeading.
AVerticalAlign Vertical alignment. Default is gtaCenter.
ATrimming Text trimming mode. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width. Default is -1.
AMinHeight Minimum rendering height. Default is -1.
ASupportHTML When True, interprets HTML tags. Default is True.
ATestAnchor When True, performs hit-testing. Default is False.
AX X coordinate for hit-testing. Default is -1 (disabled).
AY Y coordinate for hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at the test position, or an empty string if none.

Overload 9

Renders AText inside an integer-coordinate bounding box and also returns the ID, value, and type of any interactive HTML control element at the test position.

function DrawText(ALeft, ATop, ARight, ABottom: Integer; AText: String; var AControlID: String; var AControlValue: String; var AControlType: string; AWordWrapping: Boolean = False; AHorizontalAlign: TTMSFNCGraphicsTextAlign = gtaLeading; AVerticalAlign: TTMSFNCGraphicsTextAlign = gtaCenter; ATrimming: TTMSFNCGraphicsTextTrimming = gttNone; AAngle: Single = 0; AMinWidth: Single = -1; AMinHeight: Single = -1 ;ASupportHTML: Boolean = True; ATestAnchor: Boolean = False; AX: Single = -1; AY: Single = - 1): String; overload; virtual;

Parameters

Name Description
ALeft Left edge of the bounding box in integer pixels.
ATop Top edge of the bounding box in integer pixels.
ARight Right edge of the bounding box in integer pixels.
ABottom Bottom edge of the bounding box in integer pixels.
AText Text string to render.
AControlID Receives the id attribute of any HTML input control at the test position.
AControlValue Receives the current value of any HTML input control at the test position.
AControlType Receives the element type of any HTML input control at the test position.
AWordWrapping When True, wraps text at word boundaries. Default is False.
AHorizontalAlign Horizontal alignment. Default is gtaLeading.
AVerticalAlign Vertical alignment. Default is gtaCenter.
ATrimming Text trimming mode. Default is gttNone.
AAngle Rotation angle in degrees. Default is 0.
AMinWidth Minimum rendering width. Default is -1.
AMinHeight Minimum rendering height. Default is -1.
ASupportHTML When True, interprets HTML tags. Default is True.
ATestAnchor When True, performs hit-testing. Default is False.
AX X coordinate for hit-testing. Default is -1 (disabled).
AY Y coordinate for hit-testing. Default is -1 (disabled).

Returns

The href of the HTML anchor at the test position, or an empty string if none.