Hide

SftTabs/OCX 6.5 - Tab Control for VB6

Display
Print

Features Sample (VB6)

This sample provides a simple features overview, colors, images, timer-controlled animation, shared controls.

The source code is located at C:\Program Files (x86)\Softelvdm\SftTabs OCX 6.5\Samples\Features\Form1.frm or C:\Program Files\Softelvdm\SftTabs OCX 6.5\Samples\Features\Form1.frm (on 32-bit Windows versions).

Option Explicit

Const pictureTab = 3
Dim LastPicture As Integer

Private Sub CloseButton_Click()
    End
End Sub

Private Sub AddSomeTabs(TabControl As SftTabs)
    Dim i As Integer, iTab As Integer
    ' Add tabs to the scrollable tab
    With TabControl.Direct
        .BulkUpdate = True
        .Tabs.Clear
        For i = 1 To 9
            iTab = .Tabs.Add("Tab " & i)
            .Tab(iTab).ToolTip = "ToolTip For Tab " & i
        Next
        .Tabs.Current = 0
        .MakeNaturalSize
        .BulkUpdate = False
    End With
End Sub

Private Sub Form_Load()
    ' add sample tabs to the scrollable tab controls
    ' of course this could also be done at design time
    AddSomeTabs SftTabsScrolling2
    AddSomeTabs SftTabsScrolling3
    AddSomeTabs SftTabsScrolling4
    AddSomeTabs SftTabsScrolling5
    ' align some of the background/foreground bitmaps
    ' keep in mind that these are currently hidden, so their left and top properties
    ' need to be adjusted
    '    realLeft = -1000.0 - Width - HiddenLeft
    '    HiddenLeft = -1000.0 - Left - Width
    ' and
    '    realTop = -1000.0 - Height - HiddenTop
    '    HiddenTop = -1000.0 - Top - Height
    With SftTabsNested1
        .SetOutsideOffset -1000 - .Width - .Left, -1000 - .Height - .Top
    End With
    With SftTabsDual1
        .SetOutsideOffset -1000 - .Width - .Left, -1000 - .Height - .Top
    End With
    With SftTabsDual2
        .SetOutsideOffset -1000 - .Width - .Left, -1000 - .Height - .Top
    End With
    With SftTabsSelection
        .SetOutsideOffset -1000 - .Width - .Left, -1000 - .Height - .Top
        .SetInsideOffset -1000 - .Width - .Left, -1000 - .Height - .Top
    End With
    ' resize the tab without client area
    SftTabsSelection.MakeNaturalSize
End Sub

Private Sub NextButton_Click()
    With SftTabsWizard.Direct.Tabs
        .Current = .Current + 1
    End With
End Sub

Private Sub PicTimer_Timer()
    With SftTabsPics
        LastPicture = LastPicture + 1
        .Tab(0).Image.SetImageList ImageList1, LastPicture
        If LastPicture > 16 Then LastPicture = 0
    End With
End Sub

Private Sub PreviousButton_Click()
    With SftTabsWizard.Direct.Tabs
        .Current = .Current - 1
    End With
End Sub

Private Sub SftTabsSelection_Switched()
    LabelSelected.Caption = "You clicked on """ & _
           SftTabsSelection.Tab(SftTabsSelection.Tabs.Current).Text & """"
End Sub

Private Sub SftTabsWizard_Switching(NextTab As Integer, Allow As Boolean, Refresh As Boolean)
    ' We are switching away from the current tab
    If SftTabsWizard.Tabs.Current = pictureTab Then
        PicTimer.Enabled = False
    End If
End Sub

Private Sub SftTabsWizard_Switched()
    ' A new tab has just become active
    If SftTabsWizard.Tabs.Current = pictureTab Then
        LastPicture = 0
        PicTimer.Enabled = True
    End If
End Sub

Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.