Windows API Guide: GetKeyState Function


Declare Function GetTextAlign Lib "gdi32.dll" (ByVal hdc As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

GetTextAlign determines how a device displays a line of text relative to a given reference point. The reference point is the point used to specify where the device should display a line of text. The function returns exactly three of the following flags specifying where this reference point will be relative to the text (one flag specifies horizontal position, one specifies vertical position, one determines current point updating):

TA_BASELINE = 24
The reference point will be on the baseline of the text.
TA_BOTTOM = 8
The reference point will be on the bottom edge of the bounding rectangle of the text.
TA_CENTER = 6
The reference point will be horizontally centered along the bounding rectangle of the text.
TA_LEFT = 0
The reference point will be on the left edge of the bounding rectangle of the text.
TA_NOUPDATECP = 0
Do not set the current point to the reference point.
TA_RIGHT = 2
The reference point will be on the right edge of the bounding rectangle of the text.
TA_RTLREADING = 256
Win 95/98 only:Display the text right-to-left (if the font is designed for right-to-left reading).
TA_TOP = 0
The reference point will be on the top edge of the bounding rectangle of the text.
TA_UPDATECP = 1
Set the current point to the reference point.
hdc
The device context of the device to find the reference point settings of.

Example:

' Display whether window Form1 will display text left-justified, ' centered, or right-justified relative to a given reference point. Dim refpoint As Long  ' receives reference point settings refpoint = GetTextAlign(Form1.hDC)  ' get the text alignment setting of the window If (refpoint And TA_RIGHT) = TA_RIGHT Then  ' ref. point on right edge   Debug.Print "Text will be displayed right-justified." ElseIf (refpoint And TA_CENTER) = TA_CENTER Then  ' ref. point horizontally centered   Debug.Print "Text will be displayed centered horizontally." Else  ' assume ref. point on left edge   Debug.Print "Text will be displayed left-justified." End If

See Also: SetTextAlign, TextOut
Category: Fonts & Text

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/g/gettextalign.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net