Results 1 to 3 of 3

Thread: [RESOLVED] Mouse wheel scroll issue

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2019
    Posts
    45

    Resolved [RESOLVED] Mouse wheel scroll issue

    On my form i am drawing a series of panels onto which i am drawing a thumbnail image, each with a text box below. There may be 100 or more thumbnails so the whole form scrolls. No issue there...
    ...except when using the mouse wheel scroll. If i pause scrolling and the cursor happens to be over a text box then the mouse wheel scroll won't continue; just does nothing. I move the mouse back over literally anything else, such as one of the thumbnails and mouse wheel scrolling can continue. Is there a workaround for this?

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,376

    Re: Mouse wheel scroll issue

    Obviously it is scrolling the contents (or lack thereof) in the textbox.
    I guess you'll have to thwart the textbox's processing of the mouse scroll wheel. Have to research that one. May need to capture the event manually.

    First hit. https://stackoverflow.com/questions/...g-scroll-event
    "Anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment" Robert Benchley, 1930

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2019
    Posts
    45

    Re: Mouse wheel scroll issue

    Quote Originally Posted by passel View Post
    Obviously it is scrolling the contents (or lack thereof) in the textbox.
    I guess you'll have to thwart the textbox's processing of the mouse scroll wheel. Have to research that one. May need to capture the event manually.

    First hit. https://stackoverflow.com/questions/...g-scroll-event
    Yes, obviously trying to scroll the textbox, but the link you sent worked perfectly 👍 so thanks so much for that.
    For anyone facing same the code is as below to make the textbox 'ignore' the mousewheel:
    Code:
    Imports System.Runtime.InteropServices
    
    Friend Class NoScrollTextBox
        Inherits TextBox
    
        Protected Overrides Sub WndProc(ByRef m As Message)
            If m.Msg = &H20A Then
                SendMessage(Me.Parent.Handle, m.Msg, m.WParam, m.LParam)
            Else
                MyBase.WndProc(m)
            End If
        End Sub
    
        <DllImport("user32.dll")>
        Private Shared Function SendMessage(hWnd As IntPtr, msg As Integer, wp As IntPtr, lp As IntPtr) As IntPtr
        End Function
    
    End Class

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