UINT SetTextAlign( UINT nFlags );
nFlags
Specifies text-alignment flags. The flags specify the relationship between a point and a rectangle that bounds the text. The point can be either the current position or coordinates specified by a text-output function. The rectangle that bounds the text is defined by the adjacent character cells in the text string.
The nFlags parameter can be one or more flags from the following three categories. Only one flag may be chosen from each category.
The first category affects text alignment in the x direction:
Value | Meaning |
TA_CENTER | Specifies alignment of the point and the horizontal center of the bounding rectangle. |
TA_LEFT | Specifies alignment of the point and the left side of the bounding rectangle. This is the default setting. |
TA_RIGHT | Specifies alignment of the point and the right side of the bounding rectangle. |
The second category affects text alignment in the y direction:
Value | Meaning |
TA_BASELINE | Specifies alignment of the point and the baseline of the chosen font. |
TA_BOTTOM | Specifies alignment of the point and the bottom of the bounding rectangle. |
TA_TOP | Specifies alignment of the point and the top of the bounding rectangle. This is the default setting. |
The third category determines whether the current position is updated when text is written:
Value | Meaning |
TA_NOUPDATECP | Specifies that the current position is not updated after each call to a text-output function. This is the default setting. |
TA_UPDATECP | Specifies that the current position is updated after each call to a text-output function. |
Sets the text-alignment flags.
The functions TextOut and ExtTextOut use these flags when positioning a string of text on a display or device. The flags specify the relationship between a specific point and a rectangle that bounds the text. The coordinates of this point are passed as parameters to the TextOut member function. The rectangle that bounds the text is formed by the adjacent character cells in the text string.
The previous text-alignment setting. The low-order byte contains the horizontal alignment and the high-order byte contains the vertical alignment. The return value is 0 if there is an error.
CDC::ExtTextOut, CDC::GetTextAlign, CDC::TabbedTextOut, CDC::TextOut, ::SetTextAlign