Set the BackColor to SSTab in VB6 (workaround)
I couldn't really find any solution to this, but after this workaround did what I needed I figured I could share it. The actual tabs will not change color with this workaround, but I can live with that.
I only tested this with SSTab having orientation = top .
Private Sub SetSSTabBackColor(SSTbCntrl As SSTab, lColor As Long) Dim ctl As Control Dim CtlTop As Long, CtlLeft As Long, CtlWidth As Long, CtlHeight As Long Dim i As Integer, CtlFound As Boolean Dim SSTabMargin As Integer SSTbCntrl.Visible = False SSTabMargin = 40 CtlTop = SSTbCntrl.TabHeight + SSTabMargin CtlLeft = SSTabMargin CtlWidth = SSTbCntrl.Width - (SSTabMargin * 2) + 10 CtlHeight = SSTbCntrl.Height - SSTbCntrl.TabHeight - (SSTabMargin * 2) + 10 ' Loop through tabs For i = 0 To SSTbCntrl.Tabs - 1 CtlFound = False For Each ctl In Controls If ctl.Name = "SSBCCntrl" & i Then CtlFound = True End If Next ctl If CtlFound Then 'control exists - don't create, just modify Controls("SSBCCntrl" & i).Move CtlLeft, CtlTop, CtlWidth, CtlHeight Controls("SSBCCntrl" & i).Caption = "" Controls("SSBCCntrl" & i).BackColor = lColor Else 'control does not exist - create Set ctl = Controls.Add("vb.label", "SSBCCntrl" & i, Me) SSTbCntrl.Tab = i Set ctl.Container = SSTbCntrl ctl.Visible = True ctl.Move CtlLeft, CtlTop, CtlWidth, CtlHeight ctl.Caption = "" ctl.BackColor = lColor End If Next i SSTbCntrl.Tab = 0 SSTbCntrl.Visible = True End SubYou can access the subroutine from the activate or resize event (not load)
Private Sub Form_Activate() SetSSTabBackColor SSTab1, vbRed End Sub