Click here to Skip to main content
15,888,212 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using the flowlayoutpanel control. I am using it to populate a group of panels each of which contains a simple UI for an interactive object. There can be dozens of them. Works a treat, but whenever the form hosting the FlowLayoutPanel gets focus, the FlowLayoutPanel jumps back to the top. This is annoying as it forces the user to scroll and find where he/she was.
Thoughts on how to prevent this would be very welcome!

I've tried creating a local int to save the current vertical scroll position (value) and then restoring it in the Paint event. This does see to work ok, but the control "bounces" into position. It still scrolls to the top automatically, and then bounces to the correct (saved) position. That just looks really unprofessional to me so I am still looking for a proper solution.

Des
Posted
Updated 11-Jan-16 5:56am
v2
Comments
Philippe Mori 11-Jan-16 12:24pm    
I never saw such problem... Does the scollbar are on the form, the FlowLayoutPanel or another panel in between.

If it works weird then maybe you are doing something unusual in some event handlers. If forms are properly activated in standard way, there are no reason why activating a form would have such behaviour.

I suppose that one reason would be that the focus is set to the first control.

I have a similar situation where I use a Panel control with a number of GroupBox controls docked TOP. The panel auto-scrolls. When the user does something within one of the GroupBox controls it was scrolling back to the top control within the panel. To solve the issue I kept a reference to the GroupBox being worked with and after the user action completes, I call the Focus method to bring the GroupBox back to being "active".
 
Share this answer
 
una solucion es cuando realices una accion en tu control,
al inicio de la accion de tu control indicar this.Focus();
y no volveras a tener el problema de rebote :)

Translation:

One solution is when you perform an action on your control,
At the beginning of the action of your control indicate this. Focus();
and you will not have the problem of rebounding again :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900