mfc textout输出字体设置

CDC *pDC;
     CFont newfont;//用来保存新字体
    CFont *oldFont;//用来保存旧字体

    newfont.CreateFontW(20,

                                            11,                                      
                                              0,

                                               0,

                                             FW_NORMAL,

                                             FALSE,

                                             FALSE,

                                             0,

                                              ANSI_CHARSET,

                                             OUT_DEFAULT_PRECIS,

                                             CLIP_DEFAULT_PRECIS,

                                              DEFAULT_QUALITY,

                                              DEFAULT_PITCH|FF_SWISS,

                                             _T("宋体")

);//创建新字体

    oldFont=pDC->SelectObject(&newfont);//选择新字体
    pDC->SetTextColor(RGB(0,255,0));//设置字体颜色
    pDC->TextOutW(10, 10, pDoc->text); //输出
    pDC->SelectObject(oldFont);//选择回老字体
    newfont.DeleteObject();//删除新字体

你可能感兴趣的:(mfc textout输出字体设置)