---
title: "GdiGraphics..::.DrawText Method (String, Font, SolidBrush, Rectangle, Boolean, Int32)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawText_6_d9d14985.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.DrawText Method (String, Font, SolidBrush, Rectangle, Boolean, Int32)
 
Draws text in the specified rectangle taking into account its line breaks and justification.
 
**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 DrawText ( _s As String, _font As Font, _brush As SolidBrush, _rect As Rectangle, _clipping As Boolean, _tabSize As Integer _
)
```
 
```csharp
public void DrawText(string s,Font font,SolidBrush brush,Rectangle rect,bool clipping,int tabSize
)
```
 
### Parameters
 
 - s
     - Type: [System.String](http://msdn2.microsoft.com/en-us/s1wwdcbf)
Multiline text 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.

 - brush
     - Type: [Aurigma.GraphicsMill.Drawing.SolidBrush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md)
 [SolidBrush](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md) object containing font color.

 - rect
     - Type: [System.Drawing.Rectangle](http://msdn2.microsoft.com/en-us/1zk39146)
Destination rectangle.

 - clipping
     - Type: [System.Boolean](http://msdn2.microsoft.com/en-us/a28wyd50)
Value specifying whether to clip the text when it does not fit the bounding rectangle. If this value is **false** all the lines of the text will be rendered regardless of the destination rectangle.

 - tabSize
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
Value which specifies the number of whitespaces to replace one tabulation character in the text.
 
## 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. 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 [Font.MeasureText](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_Font_MeasureText.htm.md) method.
 
The [DrawText()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawText.htm.md) 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** 
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.
   
## See Also

### Reference

- [GdiGraphics Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Drawing_GdiGraphics.htm.md)
- [DrawText Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_GdiGraphics_DrawText.htm.md)
- [Aurigma.GraphicsMill.Drawing Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Drawing.htm.md)
- [Font.MeasureText()](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Drawing_Font_MeasureText.htm.md)

### Manual

- [Drawing Multiline Text](https://www.graphicsmill.com/docs/gm5/DrawingMultilineText.htm.md)
