0

I'm once again turning to you since I can't find an answer anywhere else. I have a TabControl, but I want to get rid of the ugly orange bar on top of the selected tabs. I would also like to make the tab text BOLD when selected and NORMAL when not.

Is there any easy way to achieve that goal ? I don't want to use the Appearance Buttons or Flat Buttons.

Thanks for your help !

Patrice Cote
  • 3,572
  • 12
  • 43
  • 72
  • FYI, I'm under Win XP with VS 2008 (.NET v3.5) – Patrice Cote Dec 14 '10 at 17:04
  • I found this from Beth Massi : http://bethmassi.blogspot.com/2005/01/disable-tabs-on-tabcontrol.html But I still cannot change the font of the tab to BOLD when selected. I also have a problem with the tab size. My text is reformated on 2 lines when the tab is not selected. – Patrice Cote Dec 14 '10 at 17:33

1 Answers1

2

This appearance is controlled by the Visual Styles theme selected in your operating system. In general, users do not appreciate any program that ignores their theme settings, especially when they paid money for a custom one. But you can get what you want, you'll have to set the DrawMode property to OwnerDrawFixed and implement a handler for the DrawItem event. There's a good example to get you started in the MSDN Library article for this event. Just change the font assignment in that sample code.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Thanks, I'll try it. We are in a government business and they have very strict visual rules (dating from almost 10 years). Rest of the system is made in Cool:Gen which have this appearance, so I have to fit with them. Users cannot change anything on their machines. And if they do somehow, they're on their own. – Patrice Cote Dec 14 '10 at 18:14
  • Sound to me you should just turn visual styles support off. It wasn't around yet 10 years ago. Delete the Application.EnableVisualStyles() call in the Main() method in Program.cs – Hans Passant Dec 14 '10 at 18:27
  • I got it to work with your suggestion and Beth exemple. Thanks ! – Patrice Cote Dec 14 '10 at 18:37