Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Colour push buttons ?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
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 ?

 
HI

Afaik, if a CButton is declared OwnderDrawn, you have to redrawn it entirely yourself: the background, the border, the text, ...

Thierry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top