C# – Groupbox title colour

cnetwinforms

I have a form, I have turned the background black and foreground white.

I put a groupbox on the page and items in the group box.

I change the forecolor of the groupbox to white and the labels for the items it contains all turn white. But the groupbox title stays black….

I have tried groupbox.forecolor = color.white; but to no avail. How can I change the colour of the title?

Best Answer

The GroupBox property ForeColor should affect its title.

Winforms controls have inheritance where a child control should inherit the parents' fore- and background colors.

I just recreated this problem, however. I am using Visual Studio 2010:

When I placed the groupbox on the form first, set its colors, and then changed the form back- and foreground colors, the groupbox was correct. When I removed the groupbox, then placed a new one on the form with the colors already set, the groupbox title is black (despite the ForeColor property set to white).

It seems, however, that you can fix it by setting the Groupbox color to something else, then changing it back to white.