
Imports System.Drawing
Imports System.Windows.Forms

Namespace UTSModule.Station

    Public Class TreeViewEx
        Inherits TreeView
        Protected Overrides Sub WndProc(ByRef m As Message)
            If m.Msg = &H203 Then
                Dim tvhti As TreeViewHitTestInfo = HitTest(New Point(CType(m.LParam, Integer)))
                If tvhti IsNot Nothing AndAlso tvhti.Location = TreeViewHitTestLocations.StateImage Then
                    m.Result = IntPtr.Zero
                    tvhti.Node.Checked = Not tvhti.Node.Checked
                    Return
                End If
            ElseIf m.Msg = &H204 Then
                Dim tvhti As TreeViewHitTestInfo = HitTest(New Point(CType(m.LParam, Integer)))
                If tvhti IsNot Nothing Then
                    SelectedNode = tvhti.Node
                End If
            End If
            MyBase.WndProc(m)


        End Sub
    End Class
End NameSpace