?
Solved

Changing groupbox background color.

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

770 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