I would like to set the background color of a
tab control (more precisely the background color of the area next to the tabs).
I guess I have to create a custom class inherited from TabControl where I override the OnPaint method... Could anyone provide a code sample please
Thanks a lot!

TabControl background color
Ya_aa
thanks for your comments!
I stumbled across the Magic library a few days ago. But although it looked as if it provided an answer to my problem I hoped to find a simpler solution - with less overhead. After all, I don't need docking windows, tabbed groups etc., I just want to get rid of that bothersome gray area... :-(
vbasics, do you already have some experience with the library
logicdev, I would like to give your solution a try. But unfortunately I don't have a clue how to target version 1.1 of the .NET framework (I have installed both of them, 1.0 and 1.1)...
Thanks again!
Edward JJJJ
I've been using MagicLibrary for around a year and all i could say is, it's a brilliat piece of code, i took the time to study the codes and modify a thing or two.
If you don't need other controls it will be fine, you don't have to, once you put this library onto your toolbox, you just drag the TabControl, use it as it is a standard tab control
Tommy Ready
with "area next to the tabs" I mean the gray strip to the right of the selectable tabs.
I would like to embed the tab control into a panel. The strip I'm talking about should adopt the background color of that panel...
Many thanks for your help!!
ppl1
But if I set its BackColor property to SystemColors.ControlDark, the background color of the area I mentioned in my previous posts doesn't turn to ControlDark but to some brighter color. Instead of that the background color of the tabs turns to ControlDark... ! (The Appearance property is set to "MultiForm"!)
What I would like to have is a dark gray panel which contains a gray tab control. The tab control in turn contains some white tab pages. And of course - the strip to the right of the tab "handles" should be the same background color as the panel (dark gray)...
How can I accomplish this
Thanks!!
Andrew SES
I'm still relatively new to VB.NET (came from VB6). What I'm doing now is re-creating my library of controls and types. As DOTNET encourages, I'm trying to doing everything in the appropriate OOP method so I can turn on the afterburners and engage the RAD development. :)
I just finished a bunch of my own controls and am still building my library. You can see my current list here: <A href="http://www.apesoftware.com/code/desktop/">Current Ape Library</A>
If you find anything you want in my library, let me know and I'll post or send it to you. I'll keep the TabControl BackColor property in mind and try to add a control to my library that solves the problem because I certainly don't like it the way it is now.
Mattxxxxxx
Since many of our customers use 2k boxes I probably have to go for the Magic library - or wait for the release of your TabControl, vbasics... ;-)
Thanks for your feedback!
Jon Shute
You can find a new TabControl from DOTNETMAGIC that will do what you want and it's FREE. All you have to do is give them credit for using it and not try to resale it for $$.
http://www.dotnetmagic.com/index.html
I found this while looking for a solution to your problem. I think I'll give them a try as well. Free is free after all and their components looks pretty good. I'll know better later.
Have fun!
Rahul Virli
Basically set you configuration file to:
< xml version ="1.0" >
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>
Robert H
Deven Kampenhout
Here is something I discovered in .NET Framework version 1.1 that makes that gray area transparent (same as the form background): You use Windows XP styling by enabling visual styles (new to ver 1.1).
(1) Your form must be loaded from a Main() as follows:
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new myForm());
}
You have to EnableVisualStyles BEFORE the form is created, that’s why you have to use a Main method to start your app. Remember to change the start-up configuration.
(2) Several of the controls, like Button, support a property called FlatStyle, set them to System if you want them to have the XP Style too. This step is not necessary to fix your TabControl gray area problem. In fact, TabControl doesn't have a FlatStyle property.
There is one problem with all this. There appears to be a bug (or design flaw) if you are using images on you Tabs. The EnableVisualStyles() wipes out your images as if you never used them. But if you are not using any images on the tabs it works fine. Also, I have no idea if EnableVisualStyles requires Windows XP to have an effect.