Solved

Changing groupbox background color.

Posted on 1997-09-10
4
1,376 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 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…
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:

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now