C# – FlowLayoutPanel autowrapping doesn’t work with autosize

cflowlayoutpanelwinforms

.NET Framework / C# / Windows Forms

I'd like the FlowLayoutPanel to automatically adjust its width or height depending on number of controls inside of it. It also should change the number of columns/rows if there is not enough space (wrap its content). The problem is that if I set autosize then the flowlayoutpanel doesn't wrap controls I insert. Which solution is the best?

Thanks!

Best Answer

Set the FlowLayoutPanel's MaximumSize to the width you want it to wrap at. Set WrapContents = true.

Related Topic