More on Tab Control

  • Thread starter Thread starter Steven Smith
  • Start date Start date
S

Steven Smith

Is it possible to change the color of the text which
appears on each tab within a tab control ?

Thanks in advance

Regards Steve
 
Herfried thats great, exactly the effect I'm looking for,
one small problem however...

I can't see where in the code the colors are specified
for the tabs I've downloaded the example and examined the
source but I can't see it anywhere even in the windows
generated code

I've set the draw mode to OwnerDraw fixed and pasted the
code in but all this achieves is centering the text and
changes its color to white.

The example works fine so I'm obviously missing
something...

Regards Steve
 
* "Steven Smith said:
I can't see where in the code the colors are specified
for the tabs I've downloaded the example and examined the
source but I can't see it anywhere even in the windows
generated code

I've set the draw mode to OwnerDraw fixed and pasted the
code in but all this achieves is centering the text and
changes its color to white.

The example works fine so I'm obviously missing
something...

Replace the 'Brushes.Red' with the brush you want to use:

\\\
g.DrawString(strTitle, TabControl1.Font, Brushes.Red, r, sf)
///
 
I've maybe confused the situation here, I would like to
change the backcolor of the individual tabs like the
example you pointed to.

I can change the text color no problems, just can't find
the properties to get at the backcolor. I've also tried
placing the actual tab control from the example onto my
form but I just get the same results (i.e the color of
the tabs stay the same) so I presume it must be written
in the code but I just can't see it for the life of me !

confused...

Steve
 
Replace the 'Brushes.Red' with the brush you want to use:
\\\
g.DrawString(strTitle, TabControl1.Font, Brushes.Red, r, sf)
///

Herfried this statement only affects the color of the
text which appears on the tab. I can't find the code
which changes the color of the tab itself as in the
example
 
* "Steven Smith said:
Replace the 'Brushes.Red' with the brush you want to use: [...]
Herfried this statement only affects the color of the
text which appears on the tab. I can't find the code
which changes the color of the tab itself as in the
example

\\\
g.FillRectangle(Brushes.Red, e.Bounds)
///
 
Altering that statement makes all the tabs the same
color...

The example uses

\\\
br = New SolidBrush(Color.FromName(strTitle))
///

which I've just discovered must take the color from the
string contained in text property of the tab.

So if I don't want Red, Green Blue etc as my text on the
tabs how do I rework this as the

Private Sub TabControl1_DrawItem addresses the whole
tabcontrol and not the individual pages ?
 
Back
Top