I'm trying to build a rather complex UI and minimize unused space.
I have an unknown number of controls and I'd like to group them into panels. All of these panels should be added to a parent panel.
So, it might be something like a single parent panel which contains 6 child panels. One of these 6 might have 2 checkboxes and a textbox. Another might have 3 dropdowns, etc. I won't know at design time. It also may be the case that I need the child panels to show up in a specific order instead of what would be optimal for saving space.
I tried to play around with FlowLayout for both the parent panel and the child panels. I think that will be part of the solution, but I don't know quite what to do. I thought about testing every possible combination of flowbreaks and pick the combination where the parent panel height is the smallest, but that is too computationally intensive.
Are there any resources that cover this sort of thing? Or maybe my approach is wrong? I think my users are going to want the controls packed as close as possible, but with the grouping. If it weren't for trying to group them, I might be able to get by with a single parent FlowLayout panel.
I think the problem is almost like the packing problem, but it's more like a packing problem within a packing problem due to the grouping.