HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
//这段没起作用啊?
if(nCtlColor == IDC_OPEN)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
return mybrush;
}
//这段没起作用啊?
// TODO: Return a different brush if the default is not desired
//return hbr;
return mybrush;
}对话框背景倒是变了。
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
//这段没起作用啊?
if(nCtlColor == IDC_OPEN)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
return mybrush;
}
//这段没起作用啊?
// TODO: Return a different brush if the default is not desired
//return hbr;
return mybrush;
}对话框背景倒是变了。
if(nCtlColor == IDC_OPEN)> if (nCtlColor == CTLCOLOR_STATIC) // Static control For other control ,refers to MSDN
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if(nCtlColor == CTLCOLOR_STATIC)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
return mybrush;
}
if(nCtlColor == CTLCOLOR_BTN)
{
pDC->SetTextColor(RGB(255,0,0));
pDC->SetBkMode(TRANSPARENT);
return mybrush;
}