Results 1 to 6 of 6

Thread: Containers Not Growing in AutoSize

  1. #1

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,764

    Containers Not Growing in AutoSize

    I have a GroupBox that has a TableLayoutPanel docked to fill in it. In the TableLayoutPanel I have several panels docked to fill that contain a Label and one other control.

    The GroupBox, TableLayoutPanel, and Panels are all set to AutoSize where the AutoSizeMode is GrowOnly.

    I would expect that everything would grow to fit the size of all the panels combined, but instead what is happening is that it is only growing to the size of one "row" of panels. See image:
    Name:  Capture.jpg
Views: 148
Size:  13.4 KB

    There are three other panels below those three that are not being shown.

    Edit - It is worth noting that if I change the FlowLayoutPanel's FlowDirection to TopDown, that it does grow to fit the size of all the Panels. I don't want it to be TopDown though, I want to to be LeftToRight.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,744

    Re: Containers Not Growing in AutoSize

    Can you provide a screenshot of the Document Outline window to show the complete control hierarchy?

  3. #3

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,764

    Re: Containers Not Growing in AutoSize

    That was pretty cool, I wasn't aware of the Document Outline window before now.
    Name:  Capture.PNG
Views: 56
Size:  51.1 KB

  4. #4

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,764

    Re: Containers Not Growing in AutoSize

    It has been several days since any activity on this thread, so I figured I'd bump this post.

  5. #5
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,139

    Re: Containers Not Growing in AutoSize

    Quote Originally Posted by dday9 View Post
    It has been several days since any activity on this thread, so I figured I'd bump this post.
    It's clear from the Document Outline window that you're using a FlowLayoutPanel, so the 4 mentions of TableLayoutPanel in post #1 may be confusing some of our devoted readers.

    Am I correct in assuming that you set the FLP's WrapContents property to True? Unfortunately, the FLP inherited its auto-sizing from Panel, and doesn't take any notice of a wrapping occurrence (no event). If you were to set AutoScroll instead of WrapContents, you could access the hidden controls by scrolling. But I guess that's not what you want.

    Still, if all the child panels of the FLP are the same size, it shouldn't be hard to calculate the required height of the FLP necessary to show them all. I suppose you would call the method from the ControlAdded/ControlRemoved events. Or you might find it easier to use a TableLayoutPanel after all, and add or remove rows as needed.

    I believe that the WPF FlowPanel makes a better job of it...

    BB

  6. #6

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    9,764

    Re: Containers Not Growing in AutoSize

    Quote Originally Posted by boops boops View Post
    It's clear from the Document Outline window that you're using a FlowLayoutPanel, so the 4 mentions of TableLayoutPanel in post #1 may be confusing some of our devoted readers.
    Doh! I'm currently using a FlowLayoutPanel. Perhaps it was a Freudian slip of what I anticipate I'll wind up using.

    I've been in the web development land for quite some time now and got spoiled to web-specific behaviors and styling.

    This particular project is one that I'm doing for a friend, pro bono, so I don't necessarily want to take the time to brush up on my WPF nor do I want to setup a server for a web application.

    I think what I'll do is calculate the height of the FlowLayoutPanel manually, I was just trying to avoid doing that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width