16,472
社区成员
发帖
与我相关
我的任务
分享
HBRUSH CMfcDemoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
int nID = pWnd->GetDlgCtrlID();
pDC->SetBkMode(OPAQUE);
if( nID == IDC_STATIC) //对指定的控件设属性,你也可以用上面的方法针对所有的标签
{
pDC->SetTextColor(RGB(0xFF,0,0) );
pDC->SetBkMode(TRANSPARENT);
return HBRUSH(GetStockObject(HOLLOW_BRUSH));
}
return hbr;
}
在OnPaint()里面添加以下代码
CPaintDC dc(this);
CRect r;
GetClientRect(&r);
dc.FillSolidRect(&r,RGB(0xFF,0xFF,0));