Solved

Changing groupbox background color.

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HTML Video won't Autoplay on site 6 25
Tool to email me when a website changes 29 120
Form submit issue 11 80
JQuery tracking event. 3 57
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
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 …
The viewer will learn how to count occurrences of each item in an array.
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 …

863 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

18 Experts available now in Live!

Get 1:1 Help Now