MFC 字体
dc.DrawText(_T("hello"),
-1, //全部
&rect,
DT_SINGLELINE| //在一行
DT_CENTER| //水平居中
DC_VCENTER); //上下居中
dc.TextOut(100,100,_T("hello"));
CFont font;
font.creatPointFont(720,_T("仿宋"));
dc.seleceobject(&font);
逻辑字体
LOGFONT lf;
::ZeroMemory(&lf,sizeof(lf));//清空内存
lf.lfHeight= 120;
lf.lfWeight = FW_BOLD;//粗体
lf.lfItalic = TRUE;//斜体
::lstrcpy(lf.lfFaceName,_T("宋体"));//字体
CFont font2;
font2.createpointfontIndirect(&lf);
dc.selectobject(&font2);
CRect rect:
rect.offsetRect(16,16);// 向右下角平移16 16
//设置字体颜色
dc.SetTextColor(RGB(192,192,192));
CRect rect;
GetClientRect(&rect);
dc.SetViewportOrg(rect.width()/2,rect.Height()/2);//把窗口原点放到窗口中央
dc.SetBKModel(TRANSPRENT);//设置背景透明
LOGFONT lf;
::ZeroMemory(&lf,sizeof(lf));//清空内存
lf.lfHeight= 160;
lf.lfWeight = FW_BOLD;//粗体
lf.lfEscapement = 450;//旋转45度
lf.lfOrientation = 450//旋转45度
lf.lfItalic = TRUE;//斜体
::lstrcpy(lf.lfFaceName,_T("宋体"));//字体
CFont font;
font.CreatePointFontIndirtct(&lf);