Link to home
Create AccountLog in
System Programming

System Programming

--

Questions

--

Followers

Top Experts

Avatar of bhoomi_2000
bhoomi_2000

Background Color of GroupBox
Hi
I have a group box and i want to sent the BackGround color of the Group box as white ,i tried to trap the WM_CTLCOLOR for it ,it doesn't work...is there any simple way to work it out..
Bhoomi

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of inprasinpras

U have to derive UR class and map WM_CTLCOLOR to it and UR group box varible should be of that class type

Are you trying to cange the background color of the interior of the group box?

..B ekiM

Avatar of bhoomi_2000bhoomi_2000

ASKER

Hi
Yeah i have my own derived Group Box,tried to MAP the WM_CTLCOLOR for it,but unfortunately , i don't get any messages of WM_CTLCOLOR for the derived Group box,and also in the Parent class...
Yeah I am trying to change the background color of the interior of the group box..

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Group boxes don't draw their interiors (AFAIK) .. just the border.

How about you put a white rectangle (static) control inside it.


If i place a static control ,white rectangle ,it overshadows other controls and the other controls which i listed in the group box is invisible

If i place a static control ,white rectangle ,it overshadows other controls and the other controls which i listed in the group box is invisible

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of mikeblasmikeblas

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Mike: Doesn't a group box paint its interior with a hollow (or maybe null) brush?  If so (unless one is being pedantic), the group box effectively doesn't do anything to its interior (paints it with nothing).  That is the point I was trying to make.  Obviously I didn't succeed :-).

bhoomi: Whether or not the rectangle is under or over other control is a matter of dialog layout order.  You can easily control this yourself (Ctrl+D in resrouce/dialog editor).

Mike's suggestion seems to be the best.  Good idea Mike .. didn't think of deriving and doing the OnEraseBkgnd, although I've done similar things many times myself.

bhoomi: might also be worth your while looks at an MSJ article (May 1997 C/C++ Q & A) by Paul D'Lascia where he shows how to put a bitmap background on a dialog, and discusses all the ins and outs of how to make controls appear correctly over a non-standard background (which is what you'll need to do to make your white background look correct).


HI MIKE AND RON
I think Ron and mikes both of your suggestion has to be combined for effective solution.But mike the other best way is to derive a own CStatic class and trap WM_CTLCOLOR message and paint the static control with required brush.Instead of handling WM_ERASEBACKGROUND,your suggestion also is an good alternative.


System Programming

System Programming

--

Questions

--

Followers

Top Experts

Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.