When creating dialog boxes in windows they are (by default) Grey with
black text (or more propery whatever color combination is set up in
the Appearance Tab in the Display Properties Control Panel).
I want to make a dialog box with a different color scheme. What is
the cleanest way to do this? I would have thought I could set some
sort of property in the dialog box resource, but that doens't seem
possible???
-Harry |
Request for Question Clarification by
skermit-ga
on
08 Jan 2003 20:28 PST
Methinks you're asking about VB or VC++?
skermit-ga
|
Clarification of Question by
harryh-ga
on
08 Jan 2003 20:38 PST
To Clarify: I need the answer for VC++.
|
Request for Question Clarification by
studboy-ga
on
08 Jan 2003 21:53 PST
Have you tried handling the WM_CTLCOLOR message and using
CWinApp::SetDialogBkColor ?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_setting_the_dialog_box.92.s_background_color.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cwinapp.3a3a.setdialogbkcolor.asp
|
Clarification of Question by
harryh-ga
on
08 Jan 2003 22:04 PST
I am not using MFC. Just the straight windows APIs.
These comments might lead me in the right direction though (i'm looing into it).
|
Clarification of Question by
harryh-ga
on
08 Jan 2003 22:36 PST
OK, I've figured the following out.
In the Dialog box procedure, create one new variable, and add some
stuff to three different messages.
static HBRUSH hb;
WM_INITDIALOG:
CreateSolidBrush(RGB(0,0,255));
WM_CTLCOLORDLG:
return (INT_PTR)hb;
WM_DESTROY:
DeleteObject(hb);
Now the backgreound of the dialog box is blue.
But I have some child controls in my dialog box. All of their
backgrouds are still gray. What do I need to do for them?
-Harry
|
Request for Question Clarification by
studboy-ga
on
08 Jan 2003 23:13 PST
OK, I think you want to use these (depending on your child) to
return the brush:
WM_CTLCOLORBTN
WM_CTLCOLOREDIT
WM_CTLCOLORLISTBOX
WM_CTLCOLORSCROLLBAR
WM_CTLCOLORSTATIC
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devnotes/winprog/wm_ctlcolor_notification.asp
Let me know if this is what you want.
|
Request for Question Clarification by
studboy-ga
on
08 Jan 2003 23:16 PST
I mean do what you did for the dialog box to each of your child
control--handling the corresponding WM_CTLCOLOR message (depending on
the type of child control: button, edit, list, etc) to return the
desired color drawing brush.
|
Clarification of Question by
harryh-ga
on
08 Jan 2003 23:35 PST
handling these starts to do what I want, but doesn't get all the way.
WM_CTLCOLORBTN
WM_CTLCOLOREDIT
WM_CTLCOLORLISTBOX
WM_CTLCOLORSCROLLBAR
WM_CTLCOLORSTATIC
Push Buttons are still gray. In WM_CTLCOLORBTN MSDN sayss I have to
do an owner draw button if I want a not-grey button. Can this be
right?? There is no way to tell windows to dray me a button
automatically in any color but the default?
Also for some reasons the dots in my radio buttons, and the checks in
my checkboxes are still showing up Black. (Even if I SetTextColor()
while handling the messages).
|
Request for Question Clarification by
studboy-ga
on
08 Jan 2003 23:54 PST
Unfortunately, I'm afraid the MSDN document is right :)
I did some forum searches and other people confirmed this:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_10076166.html
You are also correct about the dots and checks, unfortunately...
|
Request for Question Clarification by
studboy-ga
on
09 Jan 2003 00:01 PST
See the comments posted to that "rejected" forum answer--
it mentions the checks as well.
Well, sorry Harry. This is how Microsoft implemented it.
Anyway, it's up to you to decide whether I deserve a compensation or not.
Let me know if you want me to help you with the owner drawn
custom control (but I think you probably know how to do
this already--just a bit of a hassle).
|
Clarification of Question by
harryh-ga
on
09 Jan 2003 00:14 PST
Looks like you've lead me as far as you can studboy.
You've been a GREAT help. You totally deserve compensation.
Do I just click on "Close Question" and it will take me to the payment screen?
|