Introduction
Below you'll find a brief example how to enable the default VB6 TabStrip, to take full advantage of XP/Vista themes with the use of XpControls. You no longer end up with opaque vbButtonface tab pages, but will see the gradient behind the controls, just like the OS (property) dialogs do.

There are some things you have to consider to make this work, I'll explain the most important ones briefly, please read it before you start working with the sample.

You have to use the TabStrip from Microsoft Windows Common Controls 5.0 (SP2) — version 6.0 (SP6) is not theme aware. Go figure! XpControls' transparency is accomplished by a trick, they aren't really transparent. What we're actually doing is, cheating! ;) A function called DrawTabStripCheat, draws the Tab gradient on the form's DC behind the TabStrip. We then bitblt the part an XpControl is covering – on said Tabstrip – onto the XpContols' DC. For this purpose, all XpControls have a special property: UseParentFormHdc. Let's give it a shot, shall we?
End of Introduction

Objects and Properties
I have added a sample project if you don't want to go through all the hassle. :)
Add a new form
Click the project menu, click components, scroll down untill you reach [Microsoft Windows Common Controls 5.0 (SP2)], select its checkbox – if not already selected – and click Ok.
Open the form you've just added (probably Form1) and set its properties like this:
· Name  : frmDialog
· Autoredraw  : True
· BorderStyle  : 3 – Fixed Dialog
· Caption  : vbTabstrip Demo
· HasDC  : True
· Height  : 5375
· Icon  : None
· Scalemode  : Twip
· StartUpPosition  : 2 – CenterScreen
· Width  : 5595
Click the TabStrip icon on the toolbox and drag it onto the form – any size is OK – and set its properties like this:
· Name  : MainTab
· Height  : 4200
· Left  : 135
· Top  : 135
· Width  : 5265
Click the Button icon on the toolbox and drag it onto the form – somewhere below the Tabstrip – and set its properties like this:
· Name  : cmdClose
· Caption  : &Close
· Height  : 360
· Left  : 4380
· Top  : 4460
· Width  : 975
Click the XpGroupbox icon on the toolbox and drag it onto the TabStrip (or the form, the vbTabstrip isn't a container) – any size is OK – and set its properties like this:
· Name  : TransContainer
· BackStyle  : 0 – Transparent
· BorderStyle   : 0 – None¹
· Height  : 3825
· Index  : 0
· Left  : 150
· Top  : 465
· UseParentFormHdc  : True
· Visible  : False
· Width  : 5205
Right click on TransContainer(0) and click Copy. Select (click on) the Tabstrip/Form, right click and click paste. Reselect the Tabstrip/Form, right click and click paste again. Set the Left and Top properties for both added TransContainers to the same value as TransContainer(0).

footer (1K)
End of Objects and Properties

Note
You can add controls to TransContainer(0 - 2) as usual now, just make sure you set UseParentFormHdc to True for each XpControl and when you're done, put TransContainer(0) on top (Bring to front). Or you can add the following lines to the form's Load event:

fillerblank (1K)iCurrentTab = 0

fillerblank (1K)' Make sure first TabPage is Visible.
fillerblank (1K)TransContainer(iCurrentTab).Visible = True
fillerblank (1K)' And make it topmost.
fillerblank (1K)TransContainer(iCurrentTab).ZOrder

This way you never have to worry about it any more.
But lets get on with the code!
End of Note

Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'General Declarations
Option Explicit blank (1K)'Always use Option Explicit!
Private iCurrentTab As Long
Private tR As RECT
Private bR As Boolean



Private Sub cmdOk_Click()

fillerblank (1K)Unload Me

End Sub



Private Sub Form_Activate()

Screen.MousePointer = vbNormal

End Sub



Private Sub Form_Load()

iCurrentTab = 0

'See XpControls.bas to see what this does, and in Dialog.frm how you
'can take advantage of it yourself.
Dim mkContainedControls(1)
Set mkContainedControls(0) = CollectControlsContainedBy(Me)

'* This is the only extra code you'll need to implement
'* a Vb TabStrip control with XpTransControls.


tR.Top = MainTab.Top + 330 'Header height
tR.Left = MainTab.Left
tR.Right = (MainTab.Left + MainTab.Width)
tR.Bottom = MainTab.Top + MainTab.Height

bR = DrawTabStripCheat(Me, tR.Top, tR.Left, tR.Right, tR.Bottom)

End Sub



Private Sub MainTab_Click()

If MainTab.SelectedItem.Index - 1 = iCurrentTab Then Exit Sub ' No need to change frame.
' Redraw the TabCheat (Uncomment the line below if you have redrawing problems)
'bR = DrawTabStripCheat(Me, tR.Top, tR.Left, tR.Right, tR.Bottom)

' Hide old TransContainer
TransContainer(iCurrentTab).Visible = False
' Show new TransContainer.
TransContainer(MainTab.SelectedItem.Index - 1).Visible = True
' Make topmost.
TransContainer(MainTab.SelectedItem.Index - 1).ZOrder
' Set iCurrentTab to new value.
iCurrentTab = MainTab.SelectedItem.Index - 1

End Sub
End of Code