网站首页  词典首页

请输入您要查询的函数:

 

术语 settextalign
释义 SetTextAlign
语法:
UINT SetTextAlign(
__in HDC hdc,
__in UINT fMode
);
SetTextAlign函数
该SetTextAlign函数设置为指定的设备上下文的文本对齐标志。
参数
hdc [in]
一个句柄,设备上下文。
fMode [in]
The text alignment by using a mask of the values in the following list.只有一个标志可以选择从那些影响Level和垂直对齐。此外,只有一两个标志来改变目前的位置可以选择。
ValueMeaning
TA_BASELINEThe参考点将文本的底线。
TA_BOTTOMThe参考点将在边界矩形的底部边缘。
TA_TOPThe参考点将在边界矩形的上边缘。
TA_CENTERThe参考点的Level相一致的边界矩形的中心。
TA_LEFTThe参考点将在边界矩形的左边缘。
TA_RIGHTThe参考点将在边界矩形的右边缘。
TA_NOUPDATECPThe当前的位置是不会更新后,每个文本的输出要求。该参考点是传递给文本输出功能。
TA_RTLREADINGMiddle东亚语言版本的Windows:该文本规定从右到左的阅读顺序进行,而不是默认的从左到右的顺序。这仅适用于字体到设备上下文选择要么是希伯来文或阿拉伯文。
TA_UPDATECPThe当前的位置是在每次更新文本输出要求。当前位置被用作参考点。
当电流字体有一个垂直默认的基本路线,与汉字,下面的值必须使用,而不是TA_BASELINE和TA_CENTER。
ValueMeaning
VTA_BASELINEThe参考点将文本的底线。
VTA_CENTERThe标准将是垂直排列的边界矩形的中心。
默认值是TA_LEFT,TA_TOP和TA_NOUPDATECP。
返回值
如果函数成功,返回值是以前的文本对齐设置。
如果函数失败,返回值是GDI_ERROR。
备注
在TextOut和ExtTextOut函数使用文本对齐标志定位在显示或其他设备上的文本字符串。指定的标志之间的参照点和一个矩形的文本式的关系。该参考点可以是目前的情况,或传递给一个文本输出函数的一点。
边界的矩形的文本是由文本字符串中的字符细胞。
最好的办法让左对齐文本使用两种
SetTextAlign(探知,GetTextAlign(探知)&(?TA_CENTER))

SetTextAlign(探知,TA_LEFT | <其他flags>)
您还可以使用SetTextAlign为此目的(探知,TA_LEFT),但失去任何纵向或从右到左的设置。
注意:您不应该使用TA_UPDATECP SetTextAlign当您使用ScriptStringOut,因为选定的文本是不正确呈现。如果您必须使用此标志,您可以取消设置和重置它要避免这个问题。
实例
有关示例,请参见设置文本对齐。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWingdi.h(头文件:winuser.h)
LibraryGdi32.lib
DLLGdi32.dll
参见
字体和文字概述
字体和文本函数
ExtTextOut
GetTextAlign
ScriptStringOut
TextOut
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==SetTextAlign Function
The SetTextAlign function sets the text-alignment flags for the specified device context.
Syntax
UINT SetTextAlign(
__in HDC hdc,
__in UINT fMode
);
Parameters
hdc [in]
A handle to the device context.
fMode [in]
The text alignment by using a mask of the values in the following list. Only one flag can be chosen from those that affect horizontal and vertical alignment. In addition, only one of the two flags that alter the current position can be chosen.
ValueMeaning
TA_BASELINEThe reference point will be on the base line of the text.
TA_BOTTOMThe reference point will be on the bottom edge of the bounding rectangle.
TA_TOPThe reference point will be on the top edge of the bounding rectangle.
TA_CENTERThe reference point will be aligned horizontally with the center of the bounding rectangle.
TA_LEFTThe reference point will be on the left edge of the bounding rectangle.
TA_RIGHTThe reference point will be on the right edge of the bounding rectangle.
TA_NOUPDATECPThe current position is not updated after each text output call. The reference point is passed to the text output function.
TA_RTLREADINGMiddle East language edition of Windows: The text is laid out in right to left reading order, as opposed to the default left to right order. This applies only when the font selected into the device context is either Hebrew or Arabic.
TA_UPDATECPThe current position is updated after each text output call. The current position is used as the reference point.

When the current font has a vertical default base line, as with Kanji, the following values must be used instead of TA_BASELINE and TA_CENTER.
ValueMeaning
VTA_BASELINEThe reference point will be on the base line of the text.
VTA_CENTERThe reference point will be aligned vertically with the center of the bounding rectangle.

The default values are TA_LEFT, TA_TOP, and TA_NOUPDATECP.
Return Value
If the function succeeds, the return value is the previous text-alignment setting.
If the function fails, the return value is GDI_ERROR.
Remarks
The TextOut and ExtTextOut functions use the text-alignment flags to position a string of text on a display or other device. The flags specify the relationship between a reference point and a rectangle that bounds the text. The reference point is either the current position or a point passed to a text output function.
The rectangle that bounds the text is formed by the character cells in the text string.
The best way to get left-aligned text is to use either

SetTextAlign (hdc, GetTextAlign(hdc) & (~TA_CENTER))
or

SetTextAlign (hdc,TA_LEFT | )
You can also use SetTextAlign (hdc, TA_LEFT) for this purpose, but this loses any vertical or right-to-left settings.
Note You should not use SetTextAlign with TA_UPDATECP when you are using ScriptStringOut , because selected text is not rendered correctly. If you must use this flag, you can unset and reset it as necessary to avoid the problem.
Examples
For an example, see Setting the Text Alignment .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWingdi.h (include Windows.h)
LibraryGdi32.lib
DLLGdi32.dll
See Also
Fonts and Text Overview
Font and Text Functions
ExtTextOut
GetTextAlign
ScriptStringOut
TextOut
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd145091(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:22:34