Guest_imported
New member
- Jan 1, 1970
- 0
1. add a new member CBrush m_redbrush;
2. initialize m_redbrush m_redbrush.CreateSolidBrush(RGB
(255,0,0));
HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT
nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_BUTTON){
pDC->SetBkColor(RGB(255,0,0));
pDC->SetTextColor(RGB(0,0,0));
hbr = (HBRUSH) m_redbrush; // apply the red
}
return hbr;
}
This code works fine with edit boxes but why not with push
buttons and goups boxes ?
2. initialize m_redbrush m_redbrush.CreateSolidBrush(RGB
(255,0,0));
HBRUSH CTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT
nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_BUTTON){
pDC->SetBkColor(RGB(255,0,0));
pDC->SetTextColor(RGB(0,0,0));
hbr = (HBRUSH) m_redbrush; // apply the red
}
return hbr;
}
This code works fine with edit boxes but why not with push
buttons and goups boxes ?