Solved

Scrolling with mousewheel doesn't scroll a FlowLayoutPanel

Posted on 2009-04-10
3
2,799 Views
Last Modified: 2013-12-17
(C# .NET 2.0) I have a form with a TabControl, and inside many of the tabs is a FlowLayoutPanel containing multiple images. I am unable to scroll up/down these FlowLayoutPanels with the mouse wheel - I can only do it by dragging the scrollbar at the side which is a bit of an inconvenience. How can I set some sort of method to recognise the wheel being scrolled if the mouse is within the area of the FlowLayoutPanel, and if so move the panel up and down?

Also I would like to add that the mouse does successfully scroll the panel on my laptop using the scroll side of the touchpad, yet if I plug a mouse into the laptop and use its wheel it doesn't scroll with it, so the panel is obviously only responding to certain mouse drivers it seems. Any help would be appreciated.
0
Comment
Question by:smickell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 24120412
You need to give your FlowLayoutPanel focus:

        private void flowLayoutPanel1_MouseEnter(object sender, EventArgs e)
        {
            flowLayoutPanel1.Focus();
        }

You may need to do the same thing with the PictureBoxes (I assume).  That is to say, on MouseEnter() for the PictureBoxes, give focus to "flowLayoutPanel1".
0
 

Author Comment

by:smickell
ID: 24121641
As easy as that! I didn't think that would be needed because I already tried just clicking on the FLP, keeping the mouse in that spot (so it still had 'focus') and scrolling and it made no difference.
I didn't seem to need to create an additional event for the pictureboxes, the FLP is still scrollable even when hovered over the picturebox.
Many thanks Idle_Mind and have yourself a nice 500pts.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 24122165
It just depends on how much "margin" there is between the edge of your FlowLayoutPanel and the PictureBoxes.  If the margin is very small and the user is moving the mouse fast...then the MouseEnter() event might not fire for the FlowLayoutPanel (it might instead go directly to the PictureBox).
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question