From Xojo Documentation

Class (inherits from Object2D)

Draws a text string in a vector graphics environment.

Bold Rotation TextUnit
Fill Scale Underline
FillColor Text VerticalAlignment
HorizontalAlignment TextFont X
Italic TextSize Y


The X,Y properties specify the center of the string's baseline. Strings that contain line breaks are not supported. StringShapes can be rotated, but doing so is memory intensive, especially for large strings.

Although they will appear in auto-complete and compile, the Border, BorderColor and BorderWidth properties do not do anything with StringShape.

Use the FillColor property to change the color of the text.


This example draws text rotated 90 degrees. Put it in the Paint event handler of a Canvas:

Dim s As New StringShape
s.Text = "Hello World"
s.TextFont = "Helvetica"
s.Bold = True
s.Rotation = 3.14159 / 2 // (radians, 90 degrees = pi/2)
s.Y = 100

This example aligns the StringShape to the left.

Dim s As New StringShape
s.X = 20
s.Text = "Hello World"
s.HorizontalAlignment = StringShape.Alignment.Left

See Also

ArcShape, CurveShape, FigureShape, FolderItem, Group2D, Graphics, Object2D, OvalShape, Picture, PixmapShape, RectShape, RoundRectShape classes.