I have a panels containing a bigger panel and AutoScroll = True.
I have switched from a normal panel to an UltraPanel and setting the AutoScrollPosition. When I do this in a normal panel, the scrollbar moves but in the UltraPanel it does not.
This is my code in the eventhandler of the mousewheel (UltraPanel1 contains UltraPanel2):
Private Sub panel1_MouseWheel(sender As Object, e As System.Windows.Forms.MouseEventArgs) Dim numberOfPixelsToMove As Integer = e.Delta * SystemInformation.MouseWheelScrollLines / 10
Dim newY As Integer = -UltraPanel1.ClientArea.AutoScrollPosition.Y - numberOfPixelsToMove UltraPanel1.ClientArea.AutoScrollPosition = New Point(0, newY)End Sub
I see UltraPanel2 moving but the scrollbar of UltraPanel1 does not.
Hello,
I will be happy to assist you with this issue.
May I ask you if you have controls placed inside both panels? I ask this because I found that scrolling happens to the panel only when the control inside that panel has focus. The reason why the UltraPanel1 doesn't work in this instance may be due to the control inside UltraPanel2 having focus. Please provide me with more information on how you have your layout setup and I can attempt to provide you with a solution to this issue
Please let me know if you have further questions regarding this matter.
Hi, Jose,
Yes, Panel2 contains 1 UltraLabel.Even when I set Panel2.Focus() it does not work.
Not a problem. Happy I can help!
Please let me know if you have further questions about the ultraPanel control.
I don't really see the need for that extra label because panel2 is already a control in panel1 I tested it and it works with just the panel too.
At least I know that the UltraPanel behaves differently from a normal Panel and that extra code is needed to get it working.
Thanks for the help.
Scrolling only works when the control within the panel's client area has focus. Therefore, if you have a control in Panel2, and not in Panel1, scrolling will only work for Panel2 and not for Panel1.
To create the behavior you want using the ultraPanel, I recommend that you place a control within each panel. You can then use the MouseHover event to handle the focus method to enable scrolling for the panel you're hoving over. I have attached a small sample that you can use as reference to visualize what I am describing.