Reputation: 426
Given a FlowLayoutPanel with one wide button and a sequence of narrow ones, like this:
If AutoScroll is turned on and I resize the window to make it narrower, I get a horizontal scroll bar, like this:
So far, not too unexpected: I thought the smaller buttons might wrap, but it makes sense that the scroll width is the width of the widest button, and at least some sense to make full use of the available scrolling space to lay out the other buttons.
Next, I have some code that makes the wide button narrow. Now things look like this:
This, I maintain, is decidedly a bug in FlowLayoutPanel. There is now no child control as wide as the panel. It is set to wrap. It should wrap the controls, like this:
So, the question is, what should my code do, after changing the width of the top button, to make the FlowLayoutPanel do its job and adjust the wrapping and scroll bars? I've tried various combinations of ResumeLayout(true) and PerformLayout() without success.
Upvotes: 0
Views: 396
Reputation: 426
One solution I found is to turn AutoScroll off before resizing the button and on again afterwards. (I also need to save and restore the AutoScrollPosition.) But this is ugly...is there a better way?
Upvotes: 0