// TODO: Change any attributes of the DC here if (IDC_STT_TITLE == pWnd->GetDlgCtrlID()) { pDC->SetTextColor(RGB(0, 0, 255)); pDC->SetBkMode(TRANSPARENT); hbr = m_hTitleBrush; //这里是你需要的颜色的画刷 } // TODO: Return a different brush if the default is not desired return hbr; }
CWnd *pWnd = (CWnd*)GetDlgItem(IDC_STATIC);//该控件ID
RECT rect;
pWnd->GetClientRect(&rect);
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if (IDC_STT_TITLE == pWnd->GetDlgCtrlID())
{
pDC->SetTextColor(RGB(0, 0, 255));
pDC->SetBkMode(TRANSPARENT);
hbr = m_hTitleBrush; //这里是你需要的颜色的画刷
}
// TODO: Return a different brush if the default is not desired
return hbr;
}