TextShape

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from Object2D)


New in 2019r2

Draws a text string in a vector graphics environment.

Properties
Bold FontUnit Underline
FillColor HorizontalAlignment Value
FillOpacity Italic VerticalAlignment
FontName Rotation X
FontSize Scale Y
Enumerations
Alignment

Notes

The X,Y properties specify the center of the text baseline. Text that contain line breaks are not supported. TextShapes 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.

Examples

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

Var t As New TextShape
t.Value = "Hello World"
t.FontName = "Helvetica"
t.Bold = True
t.Rotation = 3.14159 / 2 // (radians, 90 degrees = pi/2)
t.Y = 100
g.DrawObject(t)

This example aligns the TextShape to the left.

Var t As New TextShape
t.X = 20
t.Y = 20
t.Value = "Hello World"
t.HorizontalAlignment = TextShape.Alignment.Left
g.DrawObject(t)

See Also

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