<div class="meta" robots="noindex">

</div>

Method

# Graphics.DrawString

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Graphics.DrawText<graphics.drawtext>` as a replacement.

</div>

## Description

Draws the text at the specified location and in the current color. The current color is set with the ForeColor property.

## Notes

The *X* parameter specifies the distance from the left of the Graphics object in pixels. The *Y* parameter specifies the baseline for the text. The optional *WrapWidth* parameter specifies the width (in pixels) at which *Text* should wrap. The *Text* will wrap if *WrapWidth* is provided and Condense is `False</api/language/false>` (The default is `False</api/language/false>`). If *WrapWidth* is omitted, then *Text* will print on one line, even if the window or `RectControl</api/deprecated/rectcontrol>` is too narrow to contain the text. If the optional *Condense* property is `True</api/language/true>`, <span class="title-ref">DrawString</span> truncates the string to fit into the space specified by *WrapWidth* and uses an ellipsis ("...") to indicate that there is additional text that is not shown. The default values of *WrapWidth* and *Condense* are zero and `False</api/language/false>`, respectively. The default behavior is to print the string on one line.

## Sample code

This code draws text in red Helvetica 16-point:

``` xojo
g.ForeColor = &cff0000
g.TextFont = "Helvetica"
g.TextUnit = FontUnits.Point
g.TextSize = 16
g.DrawString("Hello world", 10, 130)
```

## Compatibility

All project types on all supported operating systems.
