Archived

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

monkeyman

Does anyone know how to change the color of a dialog with win32?

Recommended Posts

monkeyman    253
Hey- I am trying to change the color of a dialog box.. There is a function, SetBKColor, that doesn't do this.. There appears to be no equivalent function that does this.. I have the HWND and DC all ready.. Does anyone here know how to do this with straight win32? "Like all good things, it starts with a monkey.." Edited by - monkeyman on January 8, 2002 11:32:19 AM

Share this post


Link to post
Share on other sites
monkeyman    253
Oh, well, I ended up doing it with the Rectangle function and just tweaked it so that it stayed within the confines of the dialog..well, part of it anyway..I have some other things in there, so I was only able to make a red strip across the top, but it serves the purpose..

It would still be cool to know how to change the color of the actual dialog, though..if anyone knows how I''m interested to hear it..

"Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites
Bezzant    122
check out this message WM_CTLCOLORDLG i think thats what you after. its sent before the dialog box is drawn, so bkcolor, text color etc... can be changed here.

hope that helps, not sure its it the right one (just a quick look in msdn)

Alan

Share this post


Link to post
Share on other sites
LessBread    1415
Here''s an bit of MFC snippet that does what you want


http://www.codeguru.com/dialog/background_garcia.shtml


I detest MFC but maybe you don''t. The trick appears to be in altering the background brush used by the WNDCLASSEX structure behind the dialog.

Here''s another article that covers the topic somewhat while building some other application.


http://www.zdnet.com/pcmag/pctech/content/18/11/ut1811.005.html


Lastly - here''s the google search from which I was able to find these references within 3 pages.


http://www.google.com/search?q=changing+dialog+background+color&start=20&sa=N





‘But truth's a menace, science a public danger.’ Brave New World, Aldous Huxley

Share this post


Link to post
Share on other sites
monkeyman    253
Thanks for the links

The MFC code gave me a laugh, it''s almost identical to the win32 method during init I mentioned in my previous SetBKColor thread..

I''ll never understand why they made all this extra bloat to add to your project to "shield" the developer from the headache of straight api when in the end you have to write what is essentially win32 code anyway..

It''s almost like a sewing machine that only makes one stitch at a time, so you end up manually threading each stitch yourself..just with more hassle

"Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites