Results 1 to 5 of 5

Thread: [RESOLVED] Trapping TreeView's Scroll Events?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    195

    Resolved [RESOLVED] Trapping TreeView's Scroll Events?

    I have a custom TreeView which has been subclassed from the standard TreeView Class. The problem is that I need to do something when the ScrollBar is moved or when the ScrollBar Arrows are clicked. What are the Events I need to trap to do this?

  2. #2
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: Trapping TreeView's Scroll Events?

    Control.VisibleChanged..... just a guess....
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    195

    Cool Re: Trapping TreeView's Scroll Events?

    The only VisibleChanged event I have access to is the Trees VisibleChanged event which does not fire upon clicking the Scrollbar. How can I get a handle to the Tree's ScrollBars?
    Last edited by tim8w; Apr 20th, 2007 at 12:38 PM.

  4. #4
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: Trapping TreeView's Scroll Events?

    Sorry.... I had a brief case of stupidity on that one.....


    I'm not sure exactly which event would help. You might try these:

    MarginChanged
    MouseWheel
    RegionChanged
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    195

    Cool One Solution: Trapping TreeView's Scroll Events?

    HanneSThEGreaT from the CodeGuru forum suggested overriding the WndProc routine. This works, but I was hoping for a more elegant solution if someone has one...

    Code:
        Private Const WM_HSCROLL As Integer = &H114
        Private Const WM_VSCROLL As Integer = &H115
        Private Const WM_MOUSEWHEEL As Integer = &H20A
    
        Protected Overrides Sub WndProc(ByRef m As Message)
    
            Select Case m.Msg
                Case WM_HSCROLL
                    Me.Invalidate()
                Case WM_VSCROLL
                    Me.Invalidate()
                Case WM_MOUSEWHEEL
                    Me.Invalidate()
            End Select
            MyBase.WndProc(m)
        End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width