tags:

views:

2076

answers:

3

I have a flowlayout panel and on a resize event, I resize all the controls inside the flowlayout panel so they the width of the (flowlayoutpanel - padding - scroll bar width). On some resizes, the scroll bar is not shown, hiding most of the controls outside the area of the flowlayoutpanel while on other resizes the scroll bar is shown.I have setthe AutoScroll property on the flowlayoutpanel to true. This is all done using C#, but I have also encountered this problem in VB.net.

Is there a way to force the flowlayoutpanel to recalculate how the controls are laid out after I resize the controls in the resize event or some other way to fix this problem?

+1  A: 

By using the Refresh method (inherited from Control) you can force the control to invalidate and redraw itself and its children.

Edit: Curiously, are you doing this resize to get the effect of top-bottom stacking?

Jim Burger
A: 

I have tried the flowlayoutpanel.Refresh(); method and that doesn't work for some reason.

Maudite
No worries, I'll try and replicate your issue.
Jim Burger
+2  A: 

Try the .PreformLayout() method, see if that helps.

Alex Lyman
That's .PerformLayout() for anyone that misses it :)
C4H5As