Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSTAB colorize font on single label tab 2

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
411
0
16
IT
SSTAB colorize font on each panel tab?
possible?
Tks.
 
Different colours for each tab? No, it is a global setting (although it can probably be faked by placing e.g. a label over each tab)
 
:) I thought about the label as well, and I did try it and couldn't make it work.
The controls on each tab in SSTab are placed the way that Tab displays all controls position in the selected tab, but all other controls on other tab(s) are 'moved' way off your visible display. See Left property of any control which is placed on any 'non-selected' tab.

sal21, there are third party Tab controls that will allow you to change colors, but not the SSTab :-(


---- Andy

There is a great need for a sarcasm font.
 
>couldn't make it work.

I can .... ;-)


OP, is this the kind of thing you meant?

Video example

(yes, a little stir crazy here ...)
 
I can see that YOU can :)
Could you share your code? I don't know about sal21, but I can find a use for it.... [pc1]


---- Andy

There is a great need for a sarcasm font.
 
Sure

Code:
[blue]Option Explicit

Private MyLastTab As Integer

Private Sub Form_Activate()
    InitLabels
End Sub

Private Sub Label1_Click(Index As Integer)
    SSTab1.Tab = Index
    SSTab1_Click MyLastTab
    MyLastTab = Index
End Sub

Private Sub SSTab1_Click(PreviousTab As Integer)
    Dim lp As Long
        For lp = 0 To SSTab1.Tabs - 1
        If lp = SSTab1.Tab Then Label1(lp).Font.Bold = True Else Label1(lp).Font.Bold = False
    Next
End Sub

Public Sub InitLabels()
    Dim lp As Long
    Dim CurrentTab As Long
    CurrentTab = SSTab1.Tab
    For lp = 0 To SSTab1.Tabs - 1
        SSTab1.Tab = lp
        MoveLabels
    Next
    SSTab1.Tab = CurrentTab
    SSTab1_Click MyLastTab
End Sub

Public Sub MoveLabels()
    Dim lp As Long
    For lp = 0 To SSTab1.Tabs - 1
        If Label1(lp).Left < 0 Then Label1(lp).Left = Label1(lp).Left + 75000
    Next
End Sub[/blue]

Not production code, and assumes

1) an sstab control called SStab1 on Form1
2) You have a Label array with the same number of elements as there are tabs
3) that you have manually sized and positioned the labels (they only need to be big enough to cover the real tab caption) where you want them at design time
4) that you have manually set the colours you want for each label

The linked frm has all the above all set up for you if that seems like too much work ... :)


 
 https://files.engineering.com/getfile.aspx?folder=7a820d6a-9337-44cf-8f16-2ddf7414a882&file=Form1.frm
I will keep your code, you never know when it will came handy.... :)
Star for you.


---- Andy

There is a great need for a sarcasm font.
 
That's fine with me, I've gain some nice code :)


---- Andy

There is a great need for a sarcasm font.
 
TKS strongm for code.
i can test only toomorrow, not have a PC under hands:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top