I'm currently writing a custom-designed tab control. I created my own control instead of owner-drawing the TabControl because I figured it'd be faster and more flexible. My tab control styles itself after the VS2008 tab control; that is, when a tab is selected, part of that tab is in front of other, unselected tabs.
My tab control consists of a Panel containing all of my TabButton objects which are the actual tabs themselves. I've set the TabButton to be transparent like so:
public TabButton()
{
...
SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
UpdateStyles();
this.BackColor = Color.Transparent;
}
However, when the tab is selected and in front of another tab, the portion of the unselected tab that should appear behind the portion of the selected tab is not rendered. It's the standard SystemColors.Control
color that fills in the rest of the clipping rectangle for the selected button.
How can I achieve proper transparency in my custom control?
Also: TabButton inherits Control, that's why I needed to use SetStyle
in order to use transparency.
-Eric Smith