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

</div>

Class

# StringShape

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

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `TextShape</api/graphics/textshape>` as a replacement.

</div>

## Description

Draws a text string in a vector graphics environment.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                   | Type                                 | Read-Only | Shared |
|--------------------------------------------------------|--------------------------------------|-----------|--------|
| `Bold<stringshape.bold>`                               | `Boolean</api/data_types/boolean>`   |           |        |
| `BorderOpacity<stringshape.borderopacity>`             | `Double</api/data_types/double>`     |           |        |
| `FillColor<stringshape.fillcolor>`                     | `Color</api/data_types/color>`       |           |        |
| `FillOpacity<stringshape.fillopacity>`                 | `Double</api/data_types/double>`     |           |        |
| `HorizontalAlignment<stringshape.horizontalalignment>` | `Alignment<stringshape.alignment>`   |           |        |
| `Italic<stringshape.italic>`                           | `Boolean</api/data_types/boolean>`   |           |        |
| `Rotation<stringshape.rotation>`                       | `Double</api/data_types/double>`     |           |        |
| `Scale<stringshape.scale>`                             | `Double</api/data_types/double>`     |           |        |
| `Text<stringshape.text>`                               | `String</api/data_types/string>`     |           |        |
| `TextFont<stringshape.textfont>`                       | `String</api/data_types/string>`     |           |        |
| `TextSize<stringshape.textsize>`                       | `Double</api/data_types/double>`     |           |        |
| `TextUnit<stringshape.textunit>`                       | `FontUnits</api/graphics/fontunits>` |           |        |
| `Underline<stringshape.underline>`                     | `Boolean</api/data_types/boolean>`   |           |        |
| `VerticalAlignment<stringshape.verticalalignment>`     | `Alignment<stringshape.alignment>`   |           |        |
| `X<stringshape.x>`                                     | `Double</api/data_types/double>`     |           |        |
| `Y<stringshape.y>`                                     | `Double</api/data_types/double>`     |           |        |

## Enumerations

<div id="stringshape.alignment">

<div class="rst-class">

forsearch

</div>

</div>

StringShape.Alignment

### Alignment

Used to set the HorizontalAlignment and VerticalAlignment properties. (Left, Top, Center, Baseline, Right, Bottom)

| Enum     | Value |
|----------|-------|
| Left     | 0     |
| Top      | 1     |
| Center   | 2     |
| Baseline | 3     |
| Right    | 4     |
| Bottom   | 5     |

## Property descriptions

<div id="stringshape.bold">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.Bold

**Bold** As `Boolean</api/data_types/boolean>`

<div id="stringshape.borderopacity">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.BorderOpacity

**BorderOpacity** As `Double</api/data_types/double>`

Indicates the level of opacity.

Degrees of transparency is currently supported only on macOS and Windows. On other platforms, the border is either visible (100%) or invisible.

The following code adds a border to an `ArcShape</api/graphics/arcshape>`:

``` xojo
Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.FillColor =Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)
```

<div id="stringshape.fillcolor">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.FillColor

**FillColor** As `Color</api/data_types/color>`

The color of the interior of the shape.

<div id="stringshape.fillopacity">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.FillOpacity

**FillOpacity** As `Double</api/data_types/double>`

The opacity of the interior, from 0 (completely transparent) to 100 (opaque).

This example sets the Fill to 50% opacity.

``` xojo
Var a As New ArcShape
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.BorderOpacity = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.FillOpacity = 50
a.FillColor =Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)
```

<div id="stringshape.horizontalalignment">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.HorizontalAlignment

**HorizontalAlignment** As `Alignment<stringshape.alignment>`

Sets the horizontal alignment of the <span class="title-ref">StringShape</span>.

The choices are: Left, Center, or Right. The default is Center. The alignment is relative to the `Object2D</api/graphics/object2d>`.X property.

This example aligns the <span class="title-ref">StringShape</span> to the left.

``` xojo
Dim ss As New StringShape
ss.X = 20
ss.Text = "Hello World"
ss.HorizontalAlignment = StringShape.Alignment.Left
```

<div id="stringshape.italic">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.Italic

**Italic** As `Boolean</api/data_types/boolean>`

<div id="stringshape.rotation">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.Rotation

**Rotation** As `Double</api/data_types/double>`

Clockwise rotation, in radians, around the X, Y point. Only set the rotation after you have drawn all your objects.

This code rotates the arc 0.9 radians.

``` xojo
Var a As New ArcShape
a.Height = 150
a.Width = 150
a.Rotation = 0.90
a.arcAngle = 1.57
a.startAngle = -1.57
a.Border = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.Fill = 50
a.FillColor =Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)
```

<div id="stringshape.scale">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.Scale

**Scale** As `Double</api/data_types/double>`

The scaling factor relative to the object's original size.

The following code rescales the arc by a factor of 1.5.

``` xojo
Var a As New ArcShape
a.Scale = 1.5
a.Rotation = .90
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Border = 100
a.BorderColor = &c0000ff
a.BorderWidth = 2.75
a.Fill = 50
a.FillColor =Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)
```

<div id="stringshape.text">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.Text

**Text** As `String</api/data_types/string>`

The text to draw.

The text can be only one text style (font, font size, style) specified by the other <span class="title-ref">StringShape</span> properties. Use the FillColor property to change the color of the text. Use a carriage return between text to display with multiple lines.The default text is the empty string.

<div id="stringshape.textfont">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.TextFont

**TextFont** As `String</api/data_types/string>`

<div id="stringshape.textsize">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.TextSize

**TextSize** As `Double</api/data_types/double>`

Font size in points.

Use zero to choose the best font size for the current platform.

<div id="stringshape.textunit">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.TextUnit

**TextUnit** As `FontUnits</api/graphics/fontunits>`

The units in which TextSize is measured. The options are given in the following table.

This example sets the units to points using the class constant.

``` xojo
Dim s As New StringShape
s.TextUnit = FontUnits.Point
s.TextSize = 20
```

<div id="stringshape.underline">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.Underline

**Underline** As `Boolean</api/data_types/boolean>`

<div id="stringshape.verticalalignment">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.VerticalAlignment

**VerticalAlignment** As `Alignment<stringshape.alignment>`

Sets the vertical alignment of the <span class="title-ref">StringShape</span>.

The choices are: Top, Baseline, or Bottom. The default is Baseline. The alignment is relative to the `Object2D</api/graphics/object2d>`.X and Y properties.

This code aligns the <span class="title-ref">StringShape</span> to the top:

``` xojo
Dim ss As New StringShape
ss.X = 20
ss.Text = "Hello World"
ss.VerticalAlignment = StringShape.Alignment.Top
```

<div id="stringshape.x">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.X

**X** As `Double</api/data_types/double>`

The horizontal position of the center or main anchor point.

This example sets the horizontal position to 100 pixels from the left of the containing `Canvas</api/deprecated/canvas>`.

``` xojo
Var a As New ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.X = 100
a.Border = 100
a.BorderColor = &c0000ff
a.Fill = 50
a.FillColor =Color.RGB(255, 0, 127)
g.DrawObject(a, 0, 100)
```

<div id="stringshape.y">

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

</div>

<div class="rst-class">

forsearch

</div>

StringShape.Y

**Y** As `Double</api/data_types/double>`

The vertical position (down from top) position of the center or anchor point.

This example moves the position of the arc down 100 pixels from the top of the containing `Canvas</api/deprecated/canvas>`.

``` xojo
Var a As New ArcShape
a.Height = 150
a.Width = 150
a.ArcAngle = 1.57
a.StartAngle = -1.57
a.Y = 100
a.Border = 100
a.BorderColor = &c0000ff
a.Fill = 50
a.FillColor =Color.RGB(255, 0, 127)
g.DrawObject(a, 100, 100)
```

## Notes

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 <span class="title-ref">StringShape</span>.

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

## Sample code

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

``` xojo
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
g.DrawObject(s)
```

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

This example aligns the <span class="title-ref">StringShape</span> to the left.

``` xojo
Dim s As New StringShape
s.X = 20
s.Text = "Hello World"
s.HorizontalAlignment = StringShape.Alignment.Left
g.DrawObject(s)
```

## Compatibility

All project types on all supported operating systems.

## See also

`Object2D</api/graphics/object2d>` parent class; `ArcShape</api/graphics/arcshape>`, `CurveShape</api/graphics/curveshape>`, `FigureShape</api/graphics/figureshape>`, `FolderItem</api/files/folderitem>`, `Group2D</api/graphics/group2d>`, `Graphics</api/graphics/graphics>`, `Object2D</api/graphics/object2d>`, `OvalShape</api/graphics/ovalshape>`, `Picture</api/graphics/picture>`, `PixmapShape</api/graphics/pixmapshape>`, `RectShape</api/graphics/rectshape>`, `RoundRectShape</api/graphics/roundrectshape>` classes.
