Changing the tab portion of sstab

Hi,

I am trying to change the tab portion of the sstab by placing graphic1 in the Picture property of the sstab. My intention is to change graphic1 to graphic2 only upon clicking (the tab) and change back to graphic1 when other tab is clicked... like giving the feedback to the user knowing which tab is active. The same as if we were to use the Caption property of the sstab where the caption is highlighted only when the user clicks on the particular tab. However, i am not using the Caption property as i intended to change the appearance of the tab portion (by using the Picture property). I tried the following code under the sstab_click(PreviousTab) event:

Select Case sstDisplayUnit.Tab
Case 0
'change the tab picture
sstDisplayUnit.Picture = LoadPicture("D:\graphic2.JPG")
Case 1
'change the tab picture
sstDisplayUnit.Picture = LoadPicture("D:\other2.JPG")
End Select

But this only changes graphic1 to graphic2 upon clicking but i have no idea how to return to graphic1 when the user leave tab 0 and click on other tab.

So any idea on how i can change the graphic1 to graphic2 only when the user click on the tab and return to graphic1 when the user leave the tab?

Thanks for any guide and help in advance!

Cheers,
leynie
[1328 byte] By [leynie] at [2007-11-19 14:04:13]
# 1 Re: Changing the tab portion of sstab
Welcome to dev-archive!

You can use the TabPicture property to make it easier, so you don't need Select Case. You can set the pictures for the current and previous tabs like this:

Private Sub SSTab1_Click(PreviousTab As Integer)
SSTab1.Picture = Image1 'faster than always using LoadPicture
SSTab1.TabPicture(PreviousTab) = Nothing 'can be a picture also
End Sub
You can also use the tab number to determine the picture to load, so each tab can have a different picture even with two lines of code.

Note: You can use StdPicture objects to hold your images, so they will not be visible until used on a control.
WizBang at 2007-11-9 20:28:52 >