网站首页  词典首页

请输入您要查询的函数:

 

术语 textout
释义 TextOut
语法:
BOOL TextOut(
__in HDC hdc,
__in int nXStart,
__in int nYStart,
__in LPCTSTR lpString,
__in int cbString
);
TextOut函数
写入的TextOut函数在指定位置的字符串,使用当前选定的字体,背景颜色和文字颜色。
参数
hdc [in]
一个句柄,设备上下文。
nXStart [in]
的x坐标,在逻辑坐标,参考点,该系统使用,使该字符串。
nYStart [in]
在y坐标,在逻辑坐标,参考点,该系统使用,使该字符串。
lpString [in]
阿为字符串指针的教训。字符串不须零终止,因为cbString指定字符串的长度。
cbString [in]
该字符串的长度指向lpString。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。
备注
该参考点的解释取决于当前的文本对齐方式。应用程序可以通过调用函数的GetTextAlign这种模式下,应用程序可以通过调用改变SetTextAlign函数这种模式。
默认情况下,目前的情况是不使用或通过此功能进行更新。但是,应用程序可以调用设置为TA_UPDATECP允许系统使用fMode参数SetTextAlign功能和更新当前位置每次应用程序调用一个指定的设备上下文TextOut。当此标志设置,系统会忽略在后续TextOut调用nXStart和nYStart参数。
当TextOut函数在一个支架上的路径,系统生成的TrueType文本,其中包括每个字符加上其性质框中的路径。该区域产生,是减去文本字符框,而不是文字本身。您可以通过该纲要的TrueType文本之前设置封闭放置在路径括号TextOut函数的背景模式,以透明的区域。以下是示例代码,演示此过程。
/ /获取窗口的客户矩形
GetClientRect(的HWND,&R)的;
/ /解决方案:通过设置背景模式
/ /透明,该地区是文本本身
/ / SetBkMode(探知,透明);
/ /支架开始一个路径
BeginPath(HDC)的;
/ /发送一些文本外面的世界
TCHAR文字[] =“抛出窗外,可能造成”;
TextOut(探知,r.left,r.top,文本,ARRAYSIZE(文本));
/ /支架结束路径
EndPath(HDC)的;
/ /来自于该地区的道路
SelectClipPath(探知,RGN_AND);
/ /此为SelectClipPath产生相同的结果()
/ / SelectClipRgn(探知,PathToRegion(探知));
/ /填充区域的灰度
FillRect(探知,&R的,GetStockObject(GRAY_BRUSH));
实例
有关示例,请参见枚举已安装的字体。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWingdi.h(头文件:winuser.h)
LibraryGdi32.lib
DLLGdi32.dll
Unicode和ANSI namesTextOutW(Unicode)和TextOutA(ANSI)的
参见
字体和文字概述
字体和文本函数
GetTextAlign
SelectObject
SetBkColor
SetTextAlign
SetTextColor
TabbedTextOut
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==TextOut Function
The TextOut function writes a character string at the specified location, using the currently selected font, background color, and text color.
Syntax
BOOL TextOut(
__in HDC hdc,
__in int nXStart,
__in int nYStart,
__in LPCTSTR lpString,
__in int cbString
);
Parameters
hdc [in]
A handle to the device context.
nXStart [in]
The x-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
nYStart [in]
The y-coordinate, in logical coordinates, of the reference point that the system uses to align the string.
lpString [in]
A pointer to the string to be drawn. The string does not need to be zero-terminated, because cbString specifies the length of the string.
cbString [in]
The length of the string pointed to by lpString.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Remarks
The interpretation of the reference point depends on the current text-alignment mode. An application can retrieve this mode by calling the GetTextAlign function; an application can alter this mode by calling the SetTextAlign function.
By default, the current position is not used or updated by this function. However, an application can call the SetTextAlign function with the fMode parameter set to TA_UPDATECP to permit the system to use and update the current position each time the application calls TextOut for a specified device context. When this flag is set, the system ignores the nXStart and nYStart parameters on subsequent TextOut calls.
When the TextOut function is placed inside a path bracket, the system generates a path for the TrueType text that includes each character plus its character box. The region generated is the character box minus the text, rather than the text itself. You can obtain the region enclosed by the outline of the TrueType text by setting the background mode to transparent before placing the TextOut function in the path bracket. Following is sample code that demonstrates this procedure.

// Obtain the window's client rectangle
GetClientRect(hwnd, &r);
// THE FIX: by setting the background mode
// to transparent, the region is the text itself
// SetBkMode(hdc, TRANSPARENT);
// Bracket begin a path
BeginPath(hdc);
// Send some text out into the world
TCHAR text[ ] = "Defenestration can be hazardous";
TextOut(hdc,r.left,r.top,text, ARRAYSIZE(text));
// Bracket end a path
EndPath(hdc);
// Derive a region from that path
SelectClipPath(hdc, RGN_AND);
// This generates the same result as SelectClipPath()
// SelectClipRgn(hdc, PathToRegion(hdc));
// Fill the region with grayness
FillRect(hdc, &r, GetStockObject(GRAY_BRUSH));
Examples
For an example, see Enumerating the Installed Fonts .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWingdi.h (include Windows.h)
LibraryGdi32.lib
DLLGdi32.dll
Unicode and ANSI namesTextOutW (Unicode) and TextOutA (ANSI)
See Also
Fonts and Text Overview
Font and Text Functions
GetTextAlign
SelectObject
SetBkColor
SetTextAlign
SetTextColor
TabbedTextOut
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd145133(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:20:06