Graphics.DrawString

From Xojo Documentation

Method

Graphics.DrawString(str As String, x As Double, y As Double [, wrapWidth As Double = 0] [, condense As Boolean = False])

Supported for all project types and targets.

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 (The default is False). If WrapWidth is omitted, then Text will print on one line, even if the window or RectControl is too narrow to contain the text. If the optional Condense property is True, DrawString 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, respectively. The default behavior is to print the string on one line.

Sample Code

This code draws text in red Helvetica 16-point:

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