# GpStringAlignment enumeration
{: .no_toc }

Specifies how a string is aligned relative to its layout rectangle.

The enumeration is used for the horizontal alignment (**Alignment**) and for the vertical, or line, alignment (**LineAlignment**) of a [**StringFormat**](/twinBASIC-docs/tB/Packages/Contributed/GdiPlus/StringFormat.md). For horizontal text, *near* is the left edge for text that reads from left to right and the right edge for text that reads from right to left. For vertical text it is the top.

| Member | Value | Description |
|:-------|:------|:------------|
| **StringAlignmentNear**{: #StringAlignmentNear } | `0` | The text is aligned near the origin of the layout rectangle. |
| **StringAlignmentCenter**{: #StringAlignmentCenter } | `1` | The text is centred in the layout rectangle. |
| **StringAlignmentFar**{: #StringAlignmentFar } | `2` | The text is aligned far from the origin of the layout rectangle. |

## Used by

- [**StringFormat**](/twinBASIC-docs/tB/Packages/Contributed/GdiPlus/StringFormat.md) class: [**Alignment**](/twinBASIC-docs/tB/Packages/Contributed/GdiPlus/StringFormat.md#alignment), [**LineAlignment**](/twinBASIC-docs/tB/Packages/Contributed/GdiPlus/StringFormat.md#linealignment)

## See Also

- [StringAlignment](https://learn.microsoft.com/en-us/windows/win32/api/gdiplusenums/ne-gdiplusenums-stringalignment) -- Microsoft's documentation of the GDI+ enumeration
- [Enumerations](/twinBASIC-docs/tB/Packages/Contributed/GdiPlus/Enumerations/index.md) -- all the enumerations of the package
- [StringFormat](/twinBASIC-docs/tB/Packages/Contributed/GdiPlus/StringFormat.md) class
