Title format from a TabPage in a TabControl

How can I change dynamicly the title (color and make it bold) of a TabPage in a TabControl? Because I added the TabPages dynamicly, I want to do it by using the TabPageIndex.
ICSAutomationAsked:
Who is Participating?
 
Éric MoreauSenior .Net ConsultantCommented:
You surely have overriden the DrawItem event. This is the place where you need to modify it.

Here is an example of something I did to bold the text of the selected tab:
If CBool(e.State And DrawItemState.Selected) Then
    Dim f As Font = New Font(e.Font, FontStyle.Bold)
    e.Graphics.DrawString(Me.TabPages(e.Index).Text, f, Brushes.Red, r2, sf)
Else
    e.Graphics.DrawString(Me.TabPages(e.Index).Text, e.Font, b, r2, sf)
End If
0
 
Éric MoreauSenior .Net ConsultantCommented:
Hi ICSAutomation,

see http://dotnetrix.co.uk/tabcontrols.html

Cheers!
0
 
ICSAutomationAuthor Commented:
Thank's so far.
I can change the Background of the tabpage, but the square, where the title is written, doesn't change the color. How can I also change the color of the square?
And how can I change the style of the title. I want to write it fat....
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
Éric MoreauSenior .Net ConsultantCommented:
check these examples from the link above:
How to Change the colours of a Tabcontrols Header Item.
A Completely OwnerDraw TabControl.
0
 
ICSAutomationAuthor Commented:
very well, the I could set the backgroundcolor.
But I couldn't see how to change the textstyle of the title. I want, that it appears fat.
0
 
ICSAutomationAuthor Commented:
Thank's a lot!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.