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 |
|
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:![]() ![]() ![]() ![]() ![]() 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 ![]() Private iCurrentTab As Long Private tR As RECT Private bR As Boolean ![]() Private Sub cmdOk_Click() ![]() End Sub ![]() Private Sub Form_Activate() ![]() End Sub ![]() Private Sub Form_Load()
![]() Private Sub MainTab_Click()
|
End of Code |