15,979
社区成员
发帖
与我相关
我的任务
分享
HBRUSH CMfcDlgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
//下面代码是修改静态文本框的背景是黑色,文字颜色是红色
switch ( nCtlColor )
{
case CTLCOLOR_STATIC:
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)::GetStockObject(BLACK_BRUSH);
return hbr;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}