使用LPtoDP API问题(GDI API)
我正在挂接 ExtTextOut GDI API。 我想检索输出字符串的确切位置。
BOOL ExtTextOut(
__in HDC hdc,
__in int X,
__in int Y,
__in UINT fuOptions,
__in const RECT *lprc,
__in LPCTSTR lpString,
__in UINT cbCount,
__in const INT *lpDx
);
在特定情况下,我得到 fuOptions 参数的 ETO_CLIPPED,这意味着我可以从 RECT 参数或 X,Y 参数获取字符串的位置。
但是,当我使用 LPtoDP API 转换位置(RECT 或 X,Y)时,我得到了错误的位置(在转换之前我得到了负值)。
我猜它有一个错误的偏移量,但是当我检查以下内容时,我没有看到任何指示:
地图模式为 MM_TEXT(默认)
GetWindowOrgEx 是 0,0
GetViewportOrgEx 为 0,0
GetWindowExtEx 为 1,1
GetViewportExtEx 为 1,1
有谁有任何想法,任何帮助将不胜感激。 谢谢。
I am hooking the ExtTextOut GDI API.
There I want to retrieve the exact location of the output String.
BOOL ExtTextOut(
__in HDC hdc,
__in int X,
__in int Y,
__in UINT fuOptions,
__in const RECT *lprc,
__in LPCTSTR lpString,
__in UINT cbCount,
__in const INT *lpDx
);
In a specific case I am getting ETO_CLIPPED for the fuOptions param which mean I can get the location of the string from the RECT param or from the X,Y params.
However when I use the LPtoDP API for translating the location (RECT or X,Y) I get wrong location (before translating I get negative values).
I guess it has a wrong offset, however when I check the followings I see no indicaton for that:
Map Mode is MM_TEXT (default)
GetWindowOrgEx is 0,0
GetViewportOrgEx is 0,0
GetWindowExtEx is 1,1
GetViewportExtEx is 1,1
Does anyone have any idea, any help will be appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
显然,在 ExtTextOut fuOptions 参数中指定 ETO_CLIPPED
并不意味着文本将输出到该剪辑,这意味着不能保证设备上下文是显示设备上下文类型,并且使用的设备上下文可以是内存设备上下文,就像我的情况一样,并且因此不包含正确的坐标。
Apparently, specifying ETO_CLIPPED in the ExtTextOut fuOptions param
does not imply that the text will be output to that clip, meaning that it is not guaranteed that the device context is of type display device context, and the device context that is used can be a memory device context, as in my case, and therefore do not contains the right coordinates.