Skip to content

TextAlignment

Horizontal and vertical alignment of text drawn inside a control's bounding rectangle. Used by TextRendering.Alignment; each member combines one of three vertical positions (top, middle, bottom) with one of three horizontal positions (left, centre, right).

ConstantValueDescription
tbAlignTopLeft0Top edge, left-aligned.
tbAlignTopCenter1Top edge, horizontally centred.
tbAlignTopRight2Top edge, right-aligned.
tbAlignMiddleLeft3Vertically centred, left-aligned.
tbAlignMiddleCenter4Vertically centred, horizontally centred. The default for newly-constructed TextRendering objects.
tbAlignMiddleRight5Vertically centred, right-aligned.
tbAlignBottomLeft6Bottom edge, left-aligned.
tbAlignBottomCenter7Bottom edge, horizontally centred.
tbAlignBottomRight8Bottom edge, right-aligned.

The padding added around the text by TextRendering.Padding is applied first; the alignment then positions the text inside the padded region.

twinBASIC and LOGO copyright of "WaynePhillipsEA" author