Solved

Changing groupbox background color.

Posted on 1997-09-10
4
1,380 Views
Last Modified: 2013-12-26
How do you set the background color of a groupbox? I mean the text part in the upper right.

Neither TWindow::SetBkgndColor will work nor EvCtlcolor since there is no COLOR_GROUP.

OWL or WinAPI, doesn't matter to me. Just want it grey.

Martin
0
Comment
Question by:camitz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1299383
EvCtlColor will work. I've done it before. I don't have my code handy, but I know that if you set the id of the group box to a unique number, it is easier to find out what is happening. I recall the group box acts like a static control.

0
 
LVL 3

Expert Comment

by:msmits
ID: 1299384
I have found a solution to set the color. Normally it will show some kind of default background color. In my case it was the grey you wanted but it depends on your color scheme and on the background color of the parent.
I can post the example code as an answer.

0
 

Author Comment

by:camitz
ID: 1299385
Thui: can't get it to work.
msmits: Over to you.
0
 
LVL 3

Accepted Solution

by:
msmits earned 100 total points
ID: 1299386
The text background is the background color of the parent window, so you can either set the background of the parent to the color you want:

  SetBkgndColor(TColor::LtCyan);

or encapsulate the groupbox in a new window and set the background color of that window:

  TWindow *mywindow = new TWindow(this);
  mywindow->Attr.X = 10;
  mywindow->Attr.Y = 10;
  mywindow->Attr.W = 100;
  mywindow->Attr.H = 100;
  mywindow->SetBkgndColor(TColor::LtCyan);

  TGroupBox *mygroup = new TGroupBox(mywindow, 0, "Group 2",
                        0, 0, 100, 100);
  mygroup->SetBkgndColor(TColor::LtRed);

Replace the colors I used with the colors you want in your applications. I used separate colors to show that is is possible to change the colors and set then of from the parent window. You of course will set them to your grey value.

0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question