有没有办法获得DrawText()后文字的高度? 有高人知道DrawText()后的高度吗?谢谢了. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CSize GetTextExtent( LPCTSTR lpszString, int nCount ) const; CFont font;VERIFY(font.CreateFont( 12, // 你在画之前将这个值记录下来不就行了 0, // nWidth 0, // nEscapement 0, // nOrientation FW_NORMAL, // nWeight FALSE, // bItalic FALSE, // bUnderline 0, // cStrikeOut ANSI_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily "Arial")); CDC *pDC;TEXTMETRIC tm;CString str;pDC->GetTextMetrics(&tm);str.Format("高度为:%d",tm.tmHeight);MessageBox(str); DrawText的返回值就是你所要的高度,参见MSDN。 使用 DT_CALCRECT 格式可以返回高度 mfc用CDC::GetTextExtent CSize GetTextExtent( LPCTSTR lpszString, int nCount ) const;CSize GetTextExtent( const CString& str ) const;SDK用GetTextExtentPoint32BOOL GetTextExtentPoint32( HDC hdc, // handle to DC LPCTSTR lpString, // text string int cbString, // characters in string LPSIZE lpSize // string size); 果然Return ValueThe height of the text if the function is successful. 数字图像处理 tga文件的问题 高手帮忙啊 MFC 窗口最小化 和 窗口最小化时 显示在任务栏 求c++库函数手册 怎样在MainFrame中得到Doc文档的指针啊? 急急!!为什么GetFileSize的到的文件大小老是为0??? 怎样得到线程的HANDLE.急。请大侠帮忙。 新手问个简单问题,在线等待。 求教看过windows核心编程的人 菜鸟问题:如何在视图中的树控件随视的大小改变而改变? VC++如何创建列数可变的表头 求教:如何根据数组里的数画图 使用GDI+ 的Bitmap类打开位图之后,怎样把位图保存为原来的文件?
LPCTSTR lpszString,
int nCount
) const;
VERIFY(font.CreateFont(
12, // 你在画之前将这个值记录下来不就行了
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
"Arial"));
TEXTMETRIC tm;
CString str;
pDC->GetTextMetrics(&tm);
str.Format("高度为:%d",tm.tmHeight);
MessageBox(str);
CSize GetTextExtent(
LPCTSTR lpszString,
int nCount
) const;
CSize GetTextExtent(
const CString& str
) const;SDK用GetTextExtentPoint32
BOOL GetTextExtentPoint32(
HDC hdc, // handle to DC
LPCTSTR lpString, // text string
int cbString, // characters in string
LPSIZE lpSize // string size
);
Return Value
The height of the text if the function is successful.