Skip to main content
GameDev.net gamedev.net
🔒 Locked

Dialog Boxes

Started by omega_001 Dec 3, 2002 at 3:46 AM 2 replies 300+ views
Original Post
omega_001
omega_001
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
cippyboy
cippyboy
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
variant
variant
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...

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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.