---
title: "GdiGraphics..::.DrawString Method (String, Font, Pen, Brush, Int32, Int32)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawString_6_07649334.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# GdiGraphics.DrawString Method (String, Font, Pen, Brush, Int32, Int32)
 
Draws an outlined text at specified position.
 
**Namespace:** [Aurigma.GraphicsMill.Drawing](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Sub DrawString ( _s As String, _font As Font, _pen As Pen, _brush As Brush, _x As Integer, _y As Integer _
)
```
 
```csharp
public void DrawString(string s,Font font,Pen pen,Brush brush,int x,int y
)
```
 
### Parameters
 
 - s
     - Type: [System.String](http://msdn2.microsoft.com/en-us/s1wwdcbf)
String to draw.

 - font
     - Type: [Aurigma.GraphicsMill.Drawing.Font](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Font.htm.md)
 [Font](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Font.htm.md) object specifying text rendering options.

 - pen
     - Type: [Aurigma.GraphicsMill.Drawing.Pen](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md)
 [Pen](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md) object used to outline the text. If you need only fill the string, pass an empty pen here (you can get it with static method [Empty](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Pen_Empty.htm.md) of the [Pen](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md) class).

 - brush
     - Type: [Aurigma.GraphicsMill.Drawing.Brush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Brush.htm.md)
 [Brush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Brush.htm.md) object used to fill the text. If you need only outline the string, pass an empty brush here (you can get it with static method [Empty](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Brush_Empty.htm.md) of the [Brush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_Brush.htm.md) class).

 - x
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
X-coordinate of the text output point. Actual position of the text relatively this point is defined with [HorizontalAlignment](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Font_HorizontalAlignment.htm.md) and [VerticalAlignment](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Font_VerticalAlignment.htm.md) properties of the *font* argument.

 - y
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
Y-coordinate of the text output point. Actual position of the text relatively this point is defined with [HorizontalAlignment](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Font_HorizontalAlignment.htm.md) and [VerticalAlignment](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Font_VerticalAlignment.htm.md) properties of the *font* argument.
 
## Remarks
  
All the coordinates are measured in units specified with [Unit](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_UnitConverterObject_Unit.htm.md) property.
 
**Note** 
If you draw text on indexed bitmaps, antialiasing is disabled regardless to the [Antialiased](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Drawing_Font_Antialiased.htm.md) property value. Also, if the [GdiGraphics](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md) was created on the base of the [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md) which has [Format8bppGrayScale](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_PixelFormat.htm.md) 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](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_PixelFormat.htm.md) bitmap with grayscale palette.
 
## Examples
  
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.White, 320, 100, _
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)

Dim graphics As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmap.GetGdiGraphics()

Dim font As New Aurigma.GraphicsMill.Drawing.Font("Arial", 50, False, False)

Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.Yellow)

Dim pen As New Aurigma.GraphicsMill.Drawing.Pen(Aurigma.GraphicsMill.RgbColor.Red, 1)

'Draw both filled and outlined text
graphics.DrawString("Sample text", font, pen, brush, 20, 20)
```
 
```csharp
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(
    Aurigma.GraphicsMill.RgbColor.White, 320, 100, 
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();

Aurigma.GraphicsMill.Drawing.Font font = new Aurigma.GraphicsMill.Drawing.Font(
    "Arial", 50, false, false);

Aurigma.GraphicsMill.Drawing.SolidBrush brush = new Aurigma.GraphicsMill.Drawing.SolidBrush( 
    Aurigma.GraphicsMill.RgbColor.Yellow);

Aurigma.GraphicsMill.Drawing.Pen pen  = new Aurigma.GraphicsMill.Drawing.Pen(
    Aurigma.GraphicsMill.RgbColor.Red, 1);

//Draw both filled and outlined text
graphics.DrawString("Sample text", font, pen, brush, 20, 20);
```
   
## See Also

### Reference

- [GdiGraphics Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
- [DrawString Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawString.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
