DrawText()、DT_LEFT 和冒号移动到文本开头?
在某些 PC 上,我发现对 DrawText() 的调用导致冒号被放置在文本的开头。
dc.DrawText( "Name:", &rText, DT_LEFT | DT_VCENTER | DT_WORDBREAK );
我的电脑上的输出是,
Name:
但在一台电脑上,特别是:
:Name
如果我将 DT_LEFT 更改为 DT_CENTER,冒号将出现在它应该出现的末尾。有什么想法吗?
on some PCs I am finding that my calls to DrawText() result in colons being placed at the start of the text.
dc.DrawText( "Name:", &rText, DT_LEFT | DT_VCENTER | DT_WORDBREAK );
The output on my PC is
Name:
But on one PC in particular it is:
:Name
If I change DT_LEFT to DT_CENTER the colon appears at the end where it should. Any ideas, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,上面的代码行并不完全准确。我请求的是我派生的设置了 DT_MODIFY 标志的 CStatic 控件的样式。在一台导致冒号被移动的特定机器上。因此,为了解决这个问题,我用 0x0000FFFF 屏蔽了它们的标志,一切正常。
干杯
火花
OK, the line of code above wasn't entirely accurate. I was requesting the style of the CStatic control that I'd derived which had the DT_MODIFY flag set. On that one particular machine that resulted in the colon being moved.. So, to fix this issue I masked them flags with 0x0000FFFF and all is working fine.
Cheers
Sparky
如果将 DT_RTLREADING 传递给 DrawText,就会发生这种情况。
对于从右到左阅读的语言来说,这是正常的。
注意:据我所知,DT_MODIFY 不是 Win32 的一部分。
如果屏蔽有效,真正的原因可能是 Style 混入 (WS_GROUP) 或 ExStyle 混入 (WS_EX_STATICEDGE)。
WS_GROUP、WS_EX_STATICEDGE 和 DT_RTLREADING 均定义为 0x00020000。
This will happen if DT_RTLREADING is passed in to DrawText.
This is normal for right to left reading languages.
Note: AFAIK DT_MODIFY is not part of Win32.
If masking works, the real reason might be that Style is getting mixed in (WS_GROUP) or ExStyle is getting mixed in (WS_EX_STATICEDGE).
WS_GROUP, WS_EX_STATICEDGE and DT_RTLREADING are all defined as 0x00020000.