Graphics.DrawText Method (String, Font, SolidBrush, Int32, Int32, Int32, Int32, Boolean, Int32)

Draws the specified text in the specified rectangle taking into account its line breaks and justification.

Namespace: Aurigma.GraphicsMill.Drawing
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
public void DrawText(
	string text,
	Font font,
	SolidBrush brush,
	int x,
	int y,
	int width,
	int height,
	bool clipping,
	int tabSize
)

Parameters

text

Type: System.String

A text to draw.
font

Type: Aurigma.GraphicsMill.Drawing.Font

A Font that defines the text format.
brush

Type: Aurigma.GraphicsMill.Drawing.SolidBrush

A SolidBrush that determines the color of the drawn text.
x

Type: System.Int32

The x-coordinate of the upper-left corner of the drawn text.
y

Type: System.Int32

The y-coordinate of the upper-left corner of the drawn text.
width

Type: System.Int32

The width of the drawn text.
height

Type: System.Int32

The height of the drawn text.
clipping

Type: System.Boolean

true if the string is clipped when it does not fit the bounding rectangle; otherwise, false.
tabSize

Type: System.Int32

The number of whitespaces to replace one tabulation character in the text.

Remarks

If the destination rectangle width is 0 the text will not be wrapped during the drawing. The extent of the text drawn by this method can be measured using the MeasureText(String, Font, Int32, Int32, Boolean, Int32) method.

This method supports newline (\n in C# and vbNewLine in VB) and tabulation (\t in C# and vbTab in VB) characters. It makes the characters after the newline symbol be displayed in a new line and replaces the tabulation character with the specified number of whitespaces.

Note

When you try to draw text on a grayscale bitmap, you will notice that the text is not antialiased. The reason of this problem is that neither GDI nor GDI+ support grayscale bitmaps, therefore Graphics Mill has to imitate it as indexed bitmap with grayscale palette. However, antialiasing is impossible on indexed bitmaps.

See Also

Reference