Results 1 to 3 of 3

Thread: [RESOLVED] Middle mouse button scroll on Panel

  1. #1

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Resolved [RESOLVED] Middle mouse button scroll on Panel

    I have a winform that has a Panel that covers the whole form. The panel is scrollable but will only scroll with the side scrollbars and not the mouse's scroll wheel.

    Any idea's how to fix this?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221
    A control has to have focus to scroll with the mouse wheel. Given that a Panel cannot receive focus I'd say that you're out of luck. Controls like TextBoxes and ListBoxes will scroll with the mouse wheel no problem, but they can receive focus.

    Your only option would be to handle the MouseWheel event for each control within the Panel and then try to translate that into scrolling the Panel itself, which you'd have to do in code yourself. Note though that for controls that react to scroll events themselves you probably shouldn't scroll the Panel.
    Last edited by jmcilhinney; Nov 29th, 2005 at 07:42 AM.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Middle mouse button scroll on Panel

    Thanks for your advice jmcilhinney. I managed to get around it by having a tiny blank label on the panel and giving it focus on form load.

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