• Advertisement

Archived

This topic is now archived and is closed to further replies.

Dialog Boxes

This topic is 5526 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know if the background colour of a dialog box (in VC++ 6)can be changed? And if so how e.g. in the source code or resource editor? Thanks in advance, Kiel

Share this post


Link to post
Share on other sites
Advertisement
You can... fake it ?
Make HPEN and a HBRUSH,choose the right RGB,make curent and draw a rectangle either from 0,0 to lenght,width or -5,-5,length+5,width+5
Any other way : try to do something like a normal window
window.hbrBackground=(HBRUSH) GetSomeColor();//

Share this post


Link to post
Share on other sites
In your dialog proc function, process the WM_CTLCOLORDLG message by simply returning an HBRUSH:

case WM_CTLCOLORDLG:
return (int)CreateSolidBrush(0x00bbggrr);

Be warned that the background will be changed but if you use static labels, the background of those won''t be changed. Maybe you need to make them transparent or something...

Share this post


Link to post
Share on other sites
I tested out a couple more ideas, and if you are using static labels, process the WM_CTLCOLORSTATIC like this:

case WM_CTLCOLORSTATIC:
SetBkColor((HDC)wParam,0x00bbggrr);
return (int)CreateSolidBrush(0x00bbggrr);

That will give them a completely colored background.

Share this post


Link to post
Share on other sites

  • Advertisement