?
Solved

Changing groupbox background color.

Posted on 1997-09-10
4
Medium Priority
?
1,385 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
  • 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 200 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

864 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