VC++2015改变控件字体大小

//今天需要更改VC对话框上的控件字体大小,根据网上资源,形成代码如下,特此记录。

//改变控件字体大小
//在OnInitialDialog中调用函数更改字体大小
void CEdgeExtractAndVectorizationDlg::ChangeButtonFont(UINT idButton/*控件ID*/,int nHeight/*字体大小*/)
{
    CFont * pButtonFont;
    pButtonFont = new CFont;
    
    pButtonFont->CreateFont(nHeight, // nHeight 
        0, // nWidth 
        0, // nEscapement 
        0, // nOrientation 
        0, // nWeight 
        FALSE, // bItalic 
        FALSE, // bUnderline 
        0, // cStrikeOut 
        GB2312_CHARSET, // nCharSet //字符集
        OUT_DEFAULT_PRECIS, // nOutPrecision 
        CLIP_DEFAULT_PRECIS, // nClipPrecision 
        DEFAULT_QUALITY, // nQuality 
        DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily 
        _T("仿宋_GB2312")); // lpszFac//字体

    ((CWnd *)GetDlgItem(idButton))->SetFont(pButtonFont);
    
}

你可能感兴趣的:(控件字体)