Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everyone..

I have just started learning vc++ and mfc. Im creating a simple project with Dialogbar. my question is how to set background color for the dialogbar. Plz help me out of this. thanks in advance.
Posted

1 solution

You could implement a reaction on WM_ERASEBKGND for your bar :) :
...
BEGIN_MESSAGE_MAP(CYourBar, CYouBarBase)
  ON_WM_ERASEBKGND()
...
END_MESSAGE_MAP()
 
BOOL CYourBar::OnEraseBkgnd(CDC* pDC)
{
  CRect cClientRect;
  GetClientRect(cClientRect);
  pDC->FillSolidRect(cClientRect, RGB(0/*red*/, 128/*green*/, 0/*blue*/));
  return FALSE;
}
...
 
Share this answer
 
v2

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