您的位置:程序门 -> vc/mfc -> 进程/线程/dll



drawtext不能显示


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


drawtext不能显示[已结贴,结贴人:lhz113]
发表于:2007-12-28 14:15:47 楼主
本人在使用这个函数的时候,没有东西输出
drawtext   (m_hdcprint,       "abc\n\n12345",     20,       &strrect,       dt_calcrect ¦dt_wordbreak   );
m_hdcprint是打印机的句柄,strrect是指定的区域。
但是为什么在指定的区域上没有东西输出呢,请教!
发表于:2007-12-28 15:26:291楼 得分:20
因为你用了这个dt_calcrect
你看一下msdn里的说明:

determines   the   width   and   height   of   the   rectangle.   if   there   are   multiple   lines   of   text,   drawtext   uses   the   width   of   the   rectangle   pointed   to   by   the   lprect   parameter   and   extends   the   base   of   the   rectangle   to   bound   the   last   line   of   text.   if   the   largest   word   is   wider   than   the   rectangle,   the   width   is   expanded.   if   the   text   is   less   than   the   width   of   the   rectangle,   the   width   is   reduced.   if   there   is   only   one   line   of   text,   drawtext   modifies   the   right   side   of   the   rectangle   so   that   it   bounds   the   last   character   in   the   line.   in   either   case,   drawtext   returns   the   height   of   the   formatted   text   but   does   not   draw   the   text.
发表于:2007-12-28 15:28:402楼 得分:0
不好意思,忘记把地址给你了:
在msdn里查drawtext,看sdk里的说明

windows   gdi  
drawtext
ms-help://ms.msdnqtr.v80.chs/ms.msdn.v80/ms.win32com.v10.en/gdi/fontext_0odw.htm
发表于:2007-12-29 09:56:023楼 得分:0
我知道什么原因看不到了,   是rect设置的太小了。谢谢
发表于:2007-12-29 10:00:424楼 得分:0
对了,我还想问下,drawtext这个函数有没有自动添加下划线功能的啊


快速检索

最新资讯
热门点击