This documentation is for the old version. Go to the latest Graphics Mill docs

GdiGraphics.DrawString Method (String, Font, SolidBrush, Int32, Int32)

Draws a text string without any special effects.

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

Syntax

Visual Basic
Public Sub DrawString ( _
	s As String, _
	font As Font, _
	brush As SolidBrush, _
	x As Integer, _
	y As Integer _
)
C#
public void DrawString(
	string s,
	Font font,
	SolidBrush brush,
	int x,
	int y
)

Parameters

s

Type: System.String

String to draw.
font

Type: Aurigma.GraphicsMill.Drawing.Font

Font object specifying text rendering options.
brush

Type: Aurigma.GraphicsMill.Drawing.SolidBrush

SolidBrush object containing font color.
x

Type: System.Int32

X-coordinate of the text output point. Actual position of the text relatively this point is defined with HorizontalAlignment and VerticalAlignment properties of the font argument.
y

Type: System.Int32

Y-coordinate of the text output point. Actual position of the text relatively this point is defined with HorizontalAlignment and VerticalAlignment properties of the font argument.

Remarks

All the coordinates are measured in units specified with Unit property.

Note

If you draw text on indexed bitmaps, antialiasing is disabled regardless to the Antialiased property value. Also, if the GdiGraphics was created on the base of the Bitmap which has Format8bppGrayScale pixel format, antialiasing will not be applied for text output. The reason of this issue is that GDI does not support grayscale bitmaps. That's why Graphics Mill for .NET represents this image as Format8bppIndexed bitmap with grayscale palette.

Examples

Visual Basic
Dim bitmap As New Aurigma.GraphicsMill.Bitmap( _
 Aurigma.GraphicsMill.RgbColor.White, 300, 30, _
 Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)

Dim graphics As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmap.GetGdiGraphics

'Draw text
Dim font As New Aurigma.GraphicsMill.Drawing.Font("Arial", 20)
font.Tracking = 10

Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush( _
 Aurigma.GraphicsMill.RgbColor.Red)

graphics.DrawString("Aurigma Graphics Mill", font, brush, 150, 0)
C#
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(
    Aurigma.GraphicsMill.RgbColor.White, 300, 30,
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();

//Draw text
Aurigma.GraphicsMill.Drawing.Font font =
    new Aurigma.GraphicsMill.Drawing.Font("Arial", 20);
font.Tracking = 10;

Aurigma.GraphicsMill.Drawing.SolidBrush brush = 
    new Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.Red);

graphics.DrawString("Aurigma Graphics Mill", font, brush, 150, 0);

See Also

Reference