1个回答
展开全部
void CTectCreateFileView::OnDraw(CDC* pDC)
{
CTectCreateFileDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CFont font;
LOGFONT lf;
// Do something with the font just created...
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
CFont* def_font;
int y = 5;
for( int i = 8; i<28; )
{
lf.lfHeight = i; // request a 12-pixel-height font
strcpy(lf.lfFaceName, "宋体"); // request a face name "Arial"
VERIFY(font.CreateFontIndirect(&lf)); // create the font
def_font = pDC->SelectObject(&font);
CString strmsg;
strmsg.Format("这是%d号宋体",i);
pDC->TextOut(5, y,strmsg);
pDC->SelectObject(def_font);
font.DeleteObject();
i += 2;
y += lf.lfHeight;
}
}
在C**View::OnDraw里画即可实现
{
CTectCreateFileDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CFont font;
LOGFONT lf;
// Do something with the font just created...
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
CFont* def_font;
int y = 5;
for( int i = 8; i<28; )
{
lf.lfHeight = i; // request a 12-pixel-height font
strcpy(lf.lfFaceName, "宋体"); // request a face name "Arial"
VERIFY(font.CreateFontIndirect(&lf)); // create the font
def_font = pDC->SelectObject(&font);
CString strmsg;
strmsg.Format("这是%d号宋体",i);
pDC->TextOut(5, y,strmsg);
pDC->SelectObject(def_font);
font.DeleteObject();
i += 2;
y += lf.lfHeight;
}
}
在C**View::OnDraw里画即可实现
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询