Table of Contents

Method DrawText

Namespace
Alternet.Drawing
Assembly
Alternet.UI.Common.dll

DrawText(string, Font, Brush, RectD)

Draws text string with the specified bounds, Brush and Font objects.

public abstract void DrawText(string text, Font font, Brush brush, RectD bounds)

Parameters

text string

String to draw.

font Font

Font that defines the text format of the string.

brush Brush

Brush that determines the color and texture of the drawn text.

bounds RectD

RectD structure that specifies the bounds of the drawn text.

DrawText(string, Font, Brush, PointD)

Draws text string with the specified location, Brush and Font objects.

public abstract void DrawText(string text, Font font, Brush brush, PointD origin)

Parameters

text string

String to draw.

font Font

Font that defines the text format of the string.

brush Brush

Brush that determines the color and texture of the drawn text.

origin PointD

PointD structure that specifies the upper-left corner of the text position on the canvas.

DrawText(string, PointD)

Draws text with DefaultFont and Default.

public void DrawText(string text, PointD origin)

Parameters

text string

String to draw.

origin PointD

PointD structure that specifies the upper-left corner of the text position on the canvas.

DrawText(string, PointD, Font, Color, Color)

Draws text with the specified font, background and foreground colors. This is the fastest method to draw text.

public abstract void DrawText(string text, PointD location, Font font, Color foreColor, Color backColor)

Parameters

text string

Text to draw.

location PointD

Location used to draw the text.

font Font

Font used to draw the text.

foreColor Color

Foreground color of the text.

backColor Color

Background color of the text. If parameter is equal to Empty, background will not be painted.

DrawText(string, RectD, Font, Color, Color)

Draws text inside the bounds with the specified font, background and foreground colors.

public virtual void DrawText(string text, RectD rect, Font font, Color foreColor, Color backColor)

Parameters

text string

Text to draw.

rect RectD

Bounding rectangle used to draw the text.

font Font

Font used to draw the text.

foreColor Color

Foreground color of the text.

backColor Color

Background color of the text. If parameter is equal to Empty, background will not be painted.

DrawText(object?, Font, Brush, RectD, TextFormat)

Draws the text string at the specified location with Brush and Font objects.

public virtual RectD DrawText(object? text, Font font, Brush brush, RectD rect, TextFormat format)

Parameters

text object

String to draw.

font Font

Font that defines the text format of the string.

brush Brush

Brush that determines the color and texture of the drawn text.

rect RectD

RectD structure that specifies the bounds of the text.

format TextFormat

TextFormat that specifies formatting attributes, such as alignment and trimming, that are applied to the drawn text.

Returns

RectD

Remarks

You can pass 0 as width of the rect. In this case wrapping will not be performed, only line breaks will be applied.