开发者

Groupbox title colour

开发者 https://www.devze.com 2023-02-02 09:19 出处:网络
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 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 fo开发者_如何学编程recolor 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?


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.


You probably should create a class inherited from GroupBox and override OnPaint.

0

精彩评论

暂无评论...
验证码 换一张
取 消