Solved

Scrolling with mousewheel doesn't scroll a FlowLayoutPanel

Posted on 2009-04-10
3
2,623 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
  • 2
3 Comments
 
LVL 85

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 85

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now