您的位置:C++老鼠窝编程 新闻公告 正文
 添加时间:2008-10-06 原文发表时间:2008-10-06 人气:2


MFC 编程CDC方法GetTextExtent and DrawText DT_CALCRECT

 CString str = _T("WWWWWWWW");
 CRect r(0,0,0,0);
 pDC->DrawText(str, r, DT_CALCRECT);
 CSize s = pDC->GetTextExtent(str);
 CRect rect(CPoint(100,100),s);
 pDC->DrawText(str,rect,DT_LEFT);
 rect.top+=10;
 pDC->Rectangle(rect);
 pDC->Rectangle(r);

为什么在另一个程序就的到不同的大小呢, 终于发现原来是CDC中使用的字体有所不同,大小就会不同。。。
本页地址
相关文章

GetTextMetrics与GetTextExtent的区别
afxtempl.h 254行 debug assertion failed
_CrtIsValidHeapPointer(PUserData) on exi
_CrtIsValidHeapPointer fails on globally
_ASSERTE(_CrtIsValidHeapPointer(pUserDat
VC Debug中“please enter the path for mf
afxcontextisDLL表示什么意思呢?
_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
C++ sizeof 祥解
直接通过ODBC读写Excel表格文件

相关评论


本文章所属分类:首页 新闻公告