-
Oct 25th, 2020, 07:43 PM
#1
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:
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.
-
Oct 25th, 2020, 08:25 PM
#2
Re: Containers Not Growing in AutoSize
Can you provide a screenshot of the Document Outline window to show the complete control hierarchy?
-
Oct 26th, 2020, 11:03 AM
#3
Re: Containers Not Growing in AutoSize
That was pretty cool, I wasn't aware of the Document Outline window before now.
-
Nov 1st, 2020, 08:59 PM
#4
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.
-
Nov 2nd, 2020, 11:37 AM
#5
Re: Containers Not Growing in AutoSize
Originally Posted by dday9
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
-
Nov 2nd, 2020, 03:23 PM
#6
Re: Containers Not Growing in AutoSize
Originally Posted by boops boops
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|