Dialog Boxes

Started by
2 comments, last by omega_001 21 years, 4 months ago
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
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();//

Relative Games - My apps

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...

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.

This topic is closed to new replies.

Advertisement