MFC 改变窗口和static字体颜色、大小、背景颜色






HBRUSH CUSB_IAP_ProgramDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)


{


    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);


    HBRUSH aBrush;


    // TODO:  在此更改 DC 的任何特性


    switch (nCtlColor)


    {


    case CTLCOLOR_DLG:/*对话框*/


     


        aBrush = CreateSolidBrush(RGB(136, 136, 136));


        hbr = aBrush;


    case CTLCOLOR_STATIC:/*所有静态标签*/


        pDC->SetBkColor(RGB(136, 136, 136));//背景色


        pDC->SetTextColor(RGB(255, 255,255));//文字色


        aBrush = CreateSolidBrush(RGB(136, 136, 136));


        hbr = aBrush;


        break;


    }


    // TODO:  如果默认的不是所需画笔,则返回另一个画笔


    return hbr;


}