VIS MFC的Static控件如何进行涂色?

想做一个选择颜色的对话框,已经按照大神的方法放好了static,着色又不会了。能不能给出具体的代码,谢谢!

 void CApp2Dlg::OnButton1() 
{
    // TODO: Add your control notification handler code here
    CColorDialog colorDia;
     if (colorDia.DoModal() == IDOK)
     {
          m_color = colorDia.GetColor();
          GetDlgItem(IDC_STATIC_1)->InvalidateRect(NULL);
     }
}

HBRUSH CApp2Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
    m_brush.CreateSolidBrush(m_color);
    // TODO: Change any attributes of the DC here
    UpdateData(TRUE);
    if (pWnd->GetDlgCtrlID() == IDC_STATIC_1)
    {
        pDC->SetBkColor(m_color);
        pDC->SetBkMode(OPAQUE);
        return m_brush;
    }

    UpdateData(FALSE);

    // TODO: Return a different brush if the default is not desired
    return hbr;
}

你可以使用搜索引擎查找:MFC CStatus 颜色背景

关键是重写OnCtlColor
然后
m_brush.CreateSolidBrush(m_color); //根据颜色创建画刷
return m_brush; //返回