Introduction

I had faced a big problem with the TabControl included in Visual Studio 2005. So I applied a "Mnemonic" (hot key) feature to the TabControl, and for this reason I had set the DrawMode property to OwnerDrawFixed. But setting this property removed the XP-look style for the button.

So I tried to implement the DrawItem event for re-drawing the button, but it did not seem to work. I even tried the "Sky Bound component" which is freely available on the net, but it did not match my requirement.

So, finally I decided to build my own control. I browsed the internet for some resources concerning this, but I was not satisfied with what I found.

So here is the control, in which I have applied the XP-look style with the hot key feature.

Background

First of all, we need to set the double buffering technique to improve painting and to allow the control to change its appearance:

Using the Code

To use the code, simply add a reference to the TabControl into the new project and drag the TabControl to your form.

Note

Make your comments, corrections, or additions for credits. Your feedback is most welcome.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

Comments and Discussions

Is there a way to change the size of the TabRect's? One can adjust the width that is drawn, but the TabControl will still use the original rectangle for hit tests. The reasoning behind this is for wanting to change the text size or adding images to the tab.