关于dc-> DrawText的谜团 [英] Mystery about dc->DrawText
问题描述
我们有代码显示文字,看起来像是:
   的CRect outRect(0,
           m_charHeight * SPACER *线,
 &NBSP ;        (m_charWidth +计数 - 1)* m_charWidth,
       &NBSP ; m_charHeight * SPACER *(第+行));
$
    DC-> DrawText的(outLine.data(),outRect,DT_SINGLELINE | DT_NOPREFIX);
这工作没有任何问题,直到一个客户报告文本不显示在所有。 我们注意到,在他们的情况下,行很长,每行10001个字符。 我试图缩短行长度,发现我们的代码最多可以达到4095. 当它超过
时,它就不会显示任何内容。
第二天,当我尝试向WebEx的同事演示此问题时,我发现一切正常。 无论线路有多长,都可以。 但是,一旦我停止共享桌面,它就会再次停止工作。 我再次尝试了这个和
,它总是这样。 然后我尝试与Skype共享桌面,Skype没有神奇的WebEx。
我打印出区域坐标和文本以便在WebEx上共享而不是,他们都是一样的。 必须是因为WebEx影响了直流中的一些属性,但是当我试图在调试器中看到dc时,我真的看不到任何东西。
我不知道这个问题,你能给我任何线索吗?  谢谢
喜ezdreams,
感谢在这里发帖。 p>
>>我对这个问题一无所知,你能给我任何线索吗? 谢谢。
您是否尝试使用DT_NOCLIP指定绘图而不剪切或删除DT_SINGLELINE?并您尝试使用
DrawText的
以跨度>数量的字符,与
CDC :: DrawTextEx ?
除非使用DT_NOCLIP格式,否则DrawText会剪切文本,使文本不会出现在给定矩形之外。除非给出DT_SINGLELINE格式,否则假定所有格式都有多行。如果所选字体对于
指定的矩形而言太大,则DrawText成员函数不会尝试替换较小的字体。
希望这可能对您有帮助。
最好的问候,
Sera Yu
Hi, we have code to show text, it looks like:
CRect outRect(0,
m_charHeight * SPACER * line,
(m_charWidth + count - 1) * m_charWidth,
m_charHeight * SPACER * (line + 1));
dc->DrawText(outLine.data(),outRect,DT_SINGLELINE | DT_NOPREFIX);
This works without any problem until one customer reported text doesn't show at all. We noticed in their case, the line is very long, 10001 characters per line. I tried to reduce line length and found our code works up to 4095. When it's more than that, then it doesn't show anything.
On the next day, when I try to demo this issue to my co-worker with WebEx, I found everything works. No matter how long the line is, it works. However, as soon as I stopped sharing my desktop, it stopped work again. I tried this again and again, it is always like this. Then I tried to share desktop with Skype, Skype doesn't have the magic as WebEx.
I printed out region co-ordinates and text in case sharing on WebEx and not, they are all same. It must be due to WebEx effected some properties in the dc, but when I tried to look dc in debugger, I really can't see anything there.
I have no clue on this issue, could you give me any clue on this? Thank you.
Hi ezdreams,
thanks for posting here.
>>I have no clue on this issue, could you give me any clue on this? Thank you.
Have you tried to use DT_NOCLIP which specifies drawing without clipping or remove DT_SINGLELINE ? And have you tried to use DrawText with the number of characters or with CDC::DrawTextEx?
Unless the DT_NOCLIP format is used, DrawText clips the text so that the text does not appear outside the given rectangle. All formatting is assumed to have multiple lines unless the DT_SINGLELINE format is given. If the selected font is too large for the specified rectangle, the DrawText member function does not attempt to substitute a smaller font.
Hope this could be help of you.
Best Regards,
Sera Yu
这篇关于关于dc-> DrawText的谜团的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!