Hey.

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.

Cheers!

Recommended Answers

All 4 Replies

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.

Thanks!

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.

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.