TextShape

From Xojo Documentation

Class (inherits from Object2D)


New in 2019r2

Draws a text string in a vector graphics environment.

Properties
Bold FontUnit Underline
FontName HorizontalAlignment Value
FontSize Italic VerticalAlignment
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 s As New TextShape
s.Value = "Hello World"
s.FontName = "Helvetica"
s.Bold = True
s.Rotation = 3.14159 / 2 // (radians, 90 degrees = pi/2)
s.Y = 100
g.DrawObject(s)

This example aligns the TextShape to the left.

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

See Also

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