So I have a flowlayoutpanel populated with custom user controls. Now, after each fifth control I want to have a separation label, pushing the following controls in a new row.

That works fine, except the distance between the label and the controls in the new row is way longer than required.

Here is a sample of how it looks like: http://prntscr.com/468a0y

I'd like to have the label closer to the controls, if possible.

Plesae let me know if you need anything else.


2 Years
Discussion Span
Last Post by dsimonovski1

I didn't exactly get what you need but I think you have to apply the height prperty of the row that contains the label to autosize instead of obselete or percentage.


I want it to look like this instead: http://prntscr.com/46enm1

All controls have their padding and margin set on minimum so the distance between each of them should be short. However, the container seems to set the size of each row as it has cards, not a label. If there is an autosize property for the rows, please clarify, as I am not aware of it.



Sorry now I got you I mistakenly thought that you are using a TableLayoutPanel. You are right the flowlayoutpanel have now line height property.
I have built a similar example with regular labels and controls and it is working normally. Did you try to put a different background color for the label to see if it is wide? Did you try to make the label the same width of the flowlayoutpanel to make sure that none of your user controls is on the same line with the label?
If noothing works I have a bit complex solution I can propose.

Edited by kb.net


Wow, thanks a lot!

The label's AutoSize property being set to True was the problem. I set the label width manually to approximately the container's width and it now works great.

Thanks again!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.