我想用系统初始化的字体的两倍高、两倍宽显示一些文本,以下是我的程序,但是实际Textout的文本没有被放大,请问为什么?
void CCompressorView::OnDraw(CDC* pDC)
{
LOGFONT lf;
CFont font;
CFont *pOldFont=pDC->GetCurrentFont(); pOldFont->GetLogFont(&lf);
lf.lfWidth = (long)(m_nViewZoom/100.0*lf.lfWidth);
lf.lfHeight = (long)(m_nViewZoom/100.0*lf.lfHeight); font.CreateFontIndirect(&lf);
pOldFont=pDC->SelectObject(&font); ...(具体显示文本内容) pDC->SelectObject(pOldFont);
}
void CCompressorView::OnDraw(CDC* pDC)
{
LOGFONT lf;
CFont font;
CFont *pOldFont=pDC->GetCurrentFont(); pOldFont->GetLogFont(&lf);
lf.lfWidth = (long)(m_nViewZoom/100.0*lf.lfWidth);
lf.lfHeight = (long)(m_nViewZoom/100.0*lf.lfHeight); font.CreateFontIndirect(&lf);
pOldFont=pDC->SelectObject(&font); ...(具体显示文本内容) pDC->SelectObject(pOldFont);
}
m_Font.CreateFont( 20, 0, 0, 0, FW_HEAVY, 1, 0, 0, GB2312_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, "宋体" );
lf.lfHeight *=2;
宽度不用设。
我不是想创造一个新字体,我是想把当前的字体对象宽、高都放大一倍to fingerfox(狐狸.兄弟会)
我把宽设置的那行注释了
//lf.lfWidth=(long)(m_nViewZoom/100.0*lf.lfWidth);
结果放大缩小都不行了
{
LOGFONT lf;
CFont font;
CFont *pOldFont=pDC->GetCurrentFont(); pOldFont->GetLogFont(&lf);
lf.lfWidth = (long)(m_nViewZoom/100.0*lf.lfWidth);
lf.lfHeight = (long)(m_nViewZoom/100.0*lf.lfHeight);
strcpy(lf.lfFaceName, "Arial");//<**************************
font.CreateFontIndirect(&lf);
pOldFont=pDC->SelectObject(&font); ...(具体显示文本内容) pDC->SelectObject(pOldFont);
}默认字体的lfFaceName是 system
system这个字体,不能超过12pixel的大小。