Click here to Skip to main content
15,908,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, guys.
How to change the text(caption) color of group box in dialog of MFC?

I use VS2008, and default caption color of group box is blue.
I want to change blue color to black color.
The following is my code. But there is no effect.
HBRUSH CTempDetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{

  HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  // TODO: Change any attributes of the DC here
  if(pWnd->GetDlgCtrlID()==IDC_STA1) //group box's id
  {
    pDC->SetBkColor(BLACK);
    pDC->SetTextColor(RED);
    pDC->SetBkMode(TRANSPARENT);
    hbr = (HBRUSH)m_brush;
  }
  return hbr;
}
CBrush m_brush;
m_brush.CreateSolidBrush(BLACK);


Help me, pls.
Thanks.
Posted
Updated 11-Jan-10 0:54am
v2

1 solution

wrote:
I use VS2008, and default caption color of group box is blue.
I want to change blue color to black color.


Actually you're setting it with
wrote:
pDC->SetTextColor(RED);


BTW: How is it defined RED symbol?
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900