Belle
asked on
SS Tab Caption
Hi all,
I'm using VB 4 and on my form I have an SS tab with 6 tabs. I've set all the caption titles of the tabs to be the colour black however I want to make it so that when I run my program and click on one of the tabs it changes colour. For exmaple, lets says my tab titles are: tab1, tab2, tab3....etc and they're all black, however if i clicked on the tab titled tab2 the colour of the caption should change from black to red and then when I click on tab3, tab2 should change back to black and the caption of tab3 should become red and so on.
This is the code I have come up with:
Private Sub SSTab1_Click
SSTab1.ForeColor = &HFF&
However that changes ALL the tab labels to red where as I only want the active tab to have a red caption. Can anyone help?
Thanx
Belle
I'm using VB 4 and on my form I have an SS tab with 6 tabs. I've set all the caption titles of the tabs to be the colour black however I want to make it so that when I run my program and click on one of the tabs it changes colour. For exmaple, lets says my tab titles are: tab1, tab2, tab3....etc and they're all black, however if i clicked on the tab titled tab2 the colour of the caption should change from black to red and then when I click on tab3, tab2 should change back to black and the caption of tab3 should become red and so on.
This is the code I have come up with:
Private Sub SSTab1_Click
SSTab1.ForeColor = &HFF&
However that changes ALL the tab labels to red where as I only want the active tab to have a red caption. Can anyone help?
Thanx
Belle
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function SetTextColor Lib "gdi32" Alias "SetTextColor" (ByVal hdc As Long, ByVal crColor As Long) As Long
Dim hDC as long
hDC = GetDC(sstab.hwnd)
SetTextColor(hdc, RGB(255,0.0)) 'Red Color
TextOut(hdc, x, y, "Caption", len("Caption"))
Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function SetTextColor Lib "gdi32" Alias "SetTextColor" (ByVal hdc As Long, ByVal crColor As Long) As Long
Dim hDC as long
hDC = GetDC(sstab.hwnd)
SetTextColor(hdc, RGB(255,0.0)) 'Red Color
TextOut(hdc, x, y, "Caption", len("Caption"))
ASKER