When using Visual Styles the forecolor is set by the current Theme.
It is possible to Inherit the controls and draw them as you wish. Groupbox
is relatively simple to modify, but TabControl is much more complex.
If you're not averse to using free third party controls, then you can
download TabControlEx from my site. The dll also includes
GroupBoxEx(supports Transparent Background) which I have just modified to
allow a custom forecolor with VisualStyles.
http://www.dotnetrix.co.uk/controls.html
If you want to attempt to create a custom TabControl then you will find
several tips on my site:
http://www.dotnetrix.co.uk/tabcontrols.html
...and some nice examples on codeproject:
http://www.codeproject.com/cs/miscctrl/flattabcontrol.asp
http://www.codeproject.com/dotnet/CustomTabControl.asp

Signature
Mick Doherty
http://dotnetrix.co.uk/nothing.html
> From all the control properties I have seen, there isn't a way of changing
> the font colour for GroupBox titles and TabPage titles. Is there any way
[quoted text clipped - 3 lines]
> make
> custom controls by the way. Any tips would be great. Thanks :o)
Andrew McNab - 11 Feb 2007 13:03 GMT
Thanks for the reply Mick. I'm not fussed about the Tab Control font. The
GroupBox is essential however. I had a bit of a surf for info on either how
to modify the groupbox title font colour or overriding the inheritance. All I
found were other controls that other people had created. I'd rather not use
3rd party controls.
In order to change the font colour, am I able to do it through the Marshal
using unmanaged code (rather not go down that path) or will I have to clone
the control and make my own 3rd party control with an altered font colour? I
read a few things about intercepting the renderer using the drawing event for
controls and changing the colour of the "brush" the engine is using while it
draws the group box border and title text. Is that the most "thread" safe way
to do it? Links to documentation about most commonly used techniques would be
fantastic.
Thanks again Mick
Mick Doherty - 11 Feb 2007 20:09 GMT
There's a quick and simple way to get the desired effect:
Set the Groupbox.Text to ""
Place a label over the groupbox where the caption would have been.
You could also just Paint over the top of the existing caption in the
groupbox's Paint() method.
This all assumes that you are using VS2002\2003, as VS2005 allows Visual
Styles with FlatStyle.Standard. The reason VS2003 does not allow a custom
caption color is that the control must use FlatStyle.System in order to be
painted with Visual Styles and, therefore, uses System Colors for the
caption. I should have mentioned this earlier.

Signature
Mick Doherty
http://dotnetrix.co.uk/nothing.html
> Thanks for the reply Mick. I'm not fussed about the Tab Control font. The
> GroupBox is essential however. I had a bit of a surf for info on either
[quoted text clipped - 21 lines]
>
> Thanks again Mick
Andrew McNab - 11 Feb 2007 22:23 GMT
Yes I am using .Net 2005. I'll have a look into the Paint() method. I
suspected that the caption was inheriting System Colours. Thanks again :o)
Mick Doherty - 12 Feb 2007 10:55 GMT
> Yes I am using .Net 2005. I'll have a look into the Paint() method. I
> suspected that the caption was inheriting System Colours. Thanks again :o)
In .net 2005, you should just set FlatStyle.Standard. The Groupbox should
then paint the caption using whatever ForeColor you set.

Signature
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Andrew McNab - 13 Feb 2007 23:31 GMT
I found the "problem". I was creating a TabControl just with the design
interface. I was messing around with properties to see what I could get the
control to look like before writing code that dynamically creates controls
during runtime. I set the fore colour of the TabPage to white. When I created
a group box within that tab page, it inherited the fore colour of the parent
but the caption text was still blue. I guess I was so tired when I was
messing around with it that I didn't try to change the fore colour of the
group box. Once you change it in the properties window, the text changes
colour. Seems the inheritance doesn't work. Thanks again :o)
Could try XTabControl from http://www.springsys.com
-j
17DD4827BB2A@microsoft.com...
> From all the control properties I have seen, there isn't a way of changing
> the font colour for GroupBox titles and TabPage titles. Is there any way
[quoted text clipped - 3 lines]
> make
> custom controls by the way. Any tips would be great. Thanks :o)