Imports System.Reflection

Imports Softelvdm.SftTreeNET
Imports Softelvdm.SftTabsNET
Imports Softelvdm.Controls

' This sample also requires SftTree/NET 2.0 to be compiled (in addition to SftTabs/NET 6.0)
' This sample also requires SftTree/NET 2.0 to be compiled (in addition to SftTabs/NET 6.0)
' This sample also requires SftTree/NET 2.0 to be compiled (in addition to SftTabs/NET 6.0)

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    sftTreeList.ItemCollection.Clear()

    For i As Integer = 4 To 13
        Dim tab As TabClass = sftTabs1.TabCollection.Add()
        tab.Text = "Tab " + i.ToString()
        tab.ToolTip = tab.Text
        tab.TextPart.PartAlignment = PartAlignmentEnum.Center
    Next

    sftTabs1.Current = 0
    sftTabs1.AllowReordering = True

    propertyGrid1.SelectedObject = sftTabs1

End Sub

Private strLastEvent As String = ""
Private fLastEventDup As Boolean = False

' This is a small helper routine to show all properties and fields of an object
Private Sub DumpValues(ByVal title As String, ByVal o As Object)

    Dim s As String = ""

    If strLastEvent = title Then
        If Not fLastEventDup Then
            s = "Additional " + title + " events ... now suppressed"
            fLastEventDup = True
        Else
            Return
        End If
    Else
        strLastEvent = title
        fLastEventDup = False

        Dim api() As PropertyInfo = o.GetType().GetProperties()
        For Each pi As PropertyInfo In api
            Dim oVal As Object = pi.GetValue(o, New Object() {})
            If oVal Is Nothing Then
                s = s + pi.Name + "=Nothing "
            Else
                s = s + pi.Name + "=" + oVal.ToString() + " "
            End If
        Next
        Dim afi() As FieldInfo = o.GetType().GetFields()
        For Each fi As FieldInfo In afi
            Dim oVal As Object = fi.GetValue(o)
            If oVal Is Nothing Then
                s = s + fi.Name + "=Nothing "
            Else
                s = s + fi.Name + "=" + oVal.ToString() + " "
            End If
        Next
    End If

    Dim item As ItemClass = sftTreeList.ItemCollection.Add(New String() {title, s})
    item.Selected = True

    sftTreeList.Columns.MakeOptimal(50, True)
    sftTreeList.RecalcHorizontalExtent()
End Sub

Private Sub sftTabs1_ClientSizeChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.ClientSizeChanged
    DumpValues("ClientSizeChanged", e)
End Sub

Private Sub sftTabs1_CloseButtonClicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.CloseButtonClicked
    DumpValues("CloseButtonClicked", e)
End Sub

Private Sub sftTabs1_DragDetected(ByVal sender As System.Object, ByVal e As Softelvdm.SftTabsNET.DragDetectedEventArgs) Handles sftTabs1.DragDetected
    DumpValues("DragDetected", e)
End Sub

Private Sub sftTabs1_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles sftTabs1.DragDrop
    DumpValues("DragDrop", e)
End Sub

Private Sub sftTabs1_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles sftTabs1.DragEnter
    DumpValues("DragEnter", e)
End Sub

Private Sub sftTabs1_DragLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.DragLeave
    DumpValues("DragLeave", e)
End Sub

Private Sub sftTabs1_DragOver(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles sftTabs1.DragOver
    DumpValues("DragOver", e)
End Sub

Private Sub sftTabs1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.Enter
    DumpValues("Enter", e)
End Sub

Private Sub sftTabs1_GiveFeedback(ByVal sender As System.Object, ByVal e As System.Windows.Forms.GiveFeedbackEventArgs) Handles sftTabs1.GiveFeedback
    DumpValues("GiveFeedback", e)
End Sub

Private Sub sftTabs1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles sftTabs1.KeyDown
    DumpValues("KeyDown", e)
End Sub

Private Sub sftTabs1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles sftTabs1.KeyPress
    DumpValues("KeyPress", e)
End Sub

Private Sub sftTabs1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles sftTabs1.KeyUp
    DumpValues("KeyUp", e)
End Sub

Private Sub sftTabs1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.Leave
    DumpValues("Leave", e)
End Sub

Private Sub sftTabs1_MinimizeButtonClicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.MinimizeButtonClicked
    DumpValues("MinimizeButtonClicked", e)
End Sub

Private Sub sftTabs1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles sftTabs1.MouseDown
    DumpValues("MouseDown", e)
End Sub

Private Sub sftTabs1_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.MouseEnter
    DumpValues("MouseEnter", e)
End Sub

Private Sub sftTabs1_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.MouseHover
    DumpValues("MouseHover", e)
End Sub

Private Sub sftTabs1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.MouseLeave
    DumpValues("MouseLeave", e)
End Sub

Private Sub sftTabs1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles sftTabs1.MouseMove
    DumpValues("MouseMove", e)
End Sub

Private Sub sftTabs1_MouseMoveHoverTimer(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.MouseMoveHoverTimer
    DumpValues("MouseMoveHoverTimer", e)
End Sub

Private Sub sftTabs1_MouseMoveTimer(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.MouseMoveTimer
    DumpValues("MouseMoveTimer", e)
End Sub

Private Sub sftTabs1_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles sftTabs1.MouseUp
    DumpValues("MouseUp", e)
End Sub

Private Sub sftTabs1_PartClicked(ByVal sender As System.Object, ByVal e As Softelvdm.SftTabsNET.PartClickedEventArgs) Handles sftTabs1.PartClicked
    DumpValues("PartClicked", e)
End Sub

Private Sub sftTabs1_QueryContinueDrag(ByVal sender As System.Object, ByVal e As System.Windows.Forms.QueryContinueDragEventArgs) Handles sftTabs1.QueryContinueDrag
    DumpValues("QueryContinueDrag", e)
End Sub

Private Sub sftTabs1_RestoreButtonClicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.RestoreButtonClicked
    DumpValues("RestoreButtonClicked", e)
End Sub

Private Sub sftTabs1_Scrolled(ByVal sender As System.Object, ByVal e As Softelvdm.SftTabsNET.ScrolledEventArgs) Handles sftTabs1.Scrolled
    DumpValues("Scrolled", e)
End Sub

Private Sub sftTabs1_Switched(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sftTabs1.Switched
    DumpValues("Switched", e)
End Sub

Private Sub sftTabs1_Switching(ByVal sender As System.Object, ByVal e As Softelvdm.SftTabsNET.SwitchingEventArgs) Handles sftTabs1.Switching
    DumpValues("Switching", e)
End Sub

Private Sub sftTabs1_SwitchingDisabled(ByVal sender As System.Object, ByVal e As Softelvdm.SftTabsNET.SwitchingEventArgs) Handles sftTabs1.SwitchingDisabled
    DumpValues("SwitchingDisabled", e)
End Sub
End Class