VERSION 5.00
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "tabctl32.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   6210
   ClientLeft      =   4290
   ClientTop       =   810
   ClientWidth     =   10080
   LinkTopic       =   "Form1"
   ScaleHeight     =   6210
   ScaleWidth      =   10080
   Begin TabDlg.SSTab tabInfo 
      DragIcon        =   "Form1.frx":0000
      Height          =   5445
      Left            =   390
      TabIndex        =   0
      Top             =   300
      Width           =   9105
      _ExtentX        =   16060
      _ExtentY        =   9604
      _Version        =   393216
      Tab             =   2
      TabHeight       =   520
      TabMaxWidth     =   1764
      TabCaption(0)   =   "Tab 0"
      TabPicture(0)   =   "Form1.frx":0442
      Tab(0).ControlEnabled=   0   'False
      Tab(0).Control(0)=   "fmeTabContainers(0)"
      Tab(0).ControlCount=   1
      TabCaption(1)   =   "Tab 1"
      TabPicture(1)   =   "Form1.frx":045E
      Tab(1).ControlEnabled=   0   'False
      Tab(1).Control(0)=   "fmeTabContainers(1)"
      Tab(1).ControlCount=   1
      TabCaption(2)   =   "Tab 2"
      TabPicture(2)   =   "Form1.frx":047A
      Tab(2).ControlEnabled=   -1  'True
      Tab(2).Control(0)=   "fmeTabContainers(2)"
      Tab(2).Control(0).Enabled=   0   'False
      Tab(2).ControlCount=   1
      Begin VB.Frame fmeTabContainers 
         Height          =   4725
         Index           =   2
         Left            =   150
         TabIndex        =   3
         Top             =   360
         Width           =   8655
         Begin VB.OptionButton Option3 
            Caption         =   "Option3"
            Height          =   435
            Left            =   300
            TabIndex        =   12
            Top             =   2220
            Width           =   3795
         End
         Begin VB.OptionButton Option2 
            Caption         =   "Option2"
            Height          =   405
            Left            =   330
            TabIndex        =   11
            Top             =   1530
            Width           =   3255
         End
         Begin VB.OptionButton Option1 
            Caption         =   "Option1"
            Height          =   405
            Left            =   390
            TabIndex        =   10
            Top             =   960
            Width           =   3255
         End
         Begin VB.CommandButton Command1 
            Caption         =   "Button for Tab 2"
            Height          =   405
            Left            =   2370
            TabIndex        =   7
            Top             =   330
            Width           =   1425
         End
         Begin VB.TextBox text2 
            Height          =   465
            Left            =   150
            TabIndex        =   4
            Text            =   "Text 2"
            Top             =   270
            Width           =   1785
         End
      End
      Begin VB.Frame fmeTabContainers 
         Height          =   4725
         Index           =   1
         Left            =   -74850
         TabIndex        =   2
         Top             =   360
         Width           =   8655
         Begin VB.CommandButton Command2 
            Caption         =   "Button for Tab 1"
            Height          =   315
            Left            =   2580
            TabIndex        =   8
            Top             =   300
            Width           =   1635
         End
         Begin VB.TextBox Text1 
            Height          =   315
            Left            =   150
            TabIndex        =   5
            Text            =   "Text 1"
            Top             =   270
            Width           =   1995
         End
      End
      Begin VB.Frame fmeTabContainers 
         Height          =   4725
         Index           =   0
         Left            =   -74850
         TabIndex        =   1
         Top             =   360
         Width           =   8655
         Begin VB.CommandButton Command3 
            Caption         =   "Button for Tab 0"
            Height          =   375
            Left            =   1770
            TabIndex        =   9
            Top             =   300
            Width           =   2175
         End
         Begin VB.TextBox Text0 
            Height          =   435
            Left            =   150
            TabIndex        =   6
            Text            =   "Text 0"
            Top             =   270
            Width           =   1395
         End
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub SwitchTabs(ByVal Tab1 As Long, ByVal Tab2 As Long)

    Dim strTemp As String
    
    strTemp = tabInfo.TabCaption(Tab1)
    tabInfo.TabCaption(Tab1) = tabInfo.TabCaption(Tab2)
    tabInfo.TabCaption(Tab2) = strTemp
    
    Dim ctl As Control
    
    For Each ctl In Me.Controls
        If ctl.Container Is fmeTabContainers(Tab1) Then
            Set ctl.Container = fmeTabContainers(Tab2)
        ElseIf ctl.Container Is fmeTabContainers(Tab2) Then
            Set ctl.Container = fmeTabContainers(Tab1)
        End If
    Next

End Sub

Private Sub tabInfo_DragDrop(Source As Control, X As Single, Y As Single)
    If Source Is tabInfo And Y < tabInfo.TabHeight Then
        Dim lngMouseTab As Long
        lngMouseTab = X \ tabInfo.TabMaxWidth
        tabInfo.Drag vbEndDrag
        SwitchTabs tabInfo.Tab, lngMouseTab
        tabInfo.Tab = lngMouseTab
    End If
End Sub

Private Sub tabInfo_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = vbRightButton And Y < tabInfo.TabHeight Then
        Dim lngMouseTab As Long
        lngMouseTab = X \ tabInfo.TabMaxWidth
        tabInfo.Tab = lngMouseTab
        tabInfo.Drag vbBeginDrag
    End If
End Sub


