Nested flowlayout panel not wrapping

Posted by SnOrfus on Stack Overflow See other posts from Stack Overflow or by SnOrfus
Published on 2010-03-25T20:32:59Z Indexed on 2010/03/25 20:43 UTC
Read the original article Hit count: 469

Filed under:
|

I've got a FlowLayoutPanel with properties:

  • Dock = Fill (in a usercontrol)
  • FlowDirection = TopDown
  • WrapContents = false

I do it this way so that each item added to the panel gets added to the bottom.

The items that I add to this panel are usercontrols which themselves have FlowLayoutPanels on them, however they have the standard behaviour (LeftToRight, WrapContents = true). The problem that I'm having is that the interior usercontrol's FlowLayoutPanel isn't resizing to fill the outer control, but when I set autosizing to true on these controls, then the panel won't wrap its contents - which is a known problem apparently.

If it helps visualize what I'm trying to do, it looks like this:

    ______________________________
    | __________________________ | Outer box = exterior flowlayout 
    | |Text____________________| |    (TopDown, NoWrap)
    | | # # # # # # # # # # # #| |
    | | # # # #                | | Interior boxes = usercontrols with text and a 
    | |________________________| |   flowlayoutpanel on them 
    | __________________________ |    (LeftToRight, Wrap)
    | |Text____________________| |   
    | | # # # # # # # # # # # #| |   # = pictures
    | | # #                    | |
    | |________________________| |
    |____________________________|

© Stack Overflow or respective owner

Related posts about winforms

Related posts about flowlayoutpanel