Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function retrieves the text-alignment setting for the specified device context.

Syntax

WINGDIAPI UINT WINAPI GetTextAlign(
  HDC 
hdc
);

Parameters

hdc

[in] Handle to the device context.

Return Value

The text–alignment setting indicates success. GDI_ERROR indicates failure. To get extended error information, call GetLastError. For more information about the return value, see the Remarks section.

The following table shows the values that can be combined to form the text–alignment setting.

Value Description

TA_BASELINE

The reference point is on the base line of the text.

TA_BOTTOM

The reference point is on the bottom edge of the bounding rectangle.

TA_TOP

The reference point is on the top edge of the bounding rectangle.

TA_CENTER

The reference point is aligned horizontally with the center of the bounding rectangle.

TA_LEFT

The reference point is on the left edge of the bounding rectangle.

TA_RIGHT

The reference point is on the right edge of the bounding rectangle.

TA_NOUPDATECP

The function does not update the current position after each text output call.

TA_UPDATECP

The function does update the current position after each text output call.

Remarks

The bounding rectangle is a rectangle bounding all of the character cells in a string of text. You can obtain the dimensions of this rectangle by calling the GetTextExtentPoint32function.

The text–alignment values determine how the ExtTextOutfunction aligns a string of text in relation to the reference point for the string that you provide to ExtTextOut.

The text–alignment values are not necessarily single bit flags and can be equal to zero. You must examine the values in groups of related values, as shown in the following list:

  • TA_LEFT, TA_RIGHT, and TA_CENTER

  • TA_BOTTOM, TA_TOP, and TA_BASELINE

  • TA_NOUPDATECP and TA_UPDATECP

To verify that a particular value is set in the return value of this function
  1. Apply the bitwise OR operator to the value and its related values.

  2. Apply the bitwise AND operator to the return value and the result of the previous operation.

  3. Test for the equality of the result of the previous operation and the value that you want to test.

Requirements

Header windows.h
Library coredll.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later

See Also