Vertical row measurement

I have a C # Winform application. In my form, I have a panel, and in my panel I have a shortcut. The label is created dynamically. I have the following code:

Label label1 = new Label();
label1.MaximumSize = new Size(400, 0);
label1.Location = new Point(posX, posY);
label1.Text = myText;
label1.AutoSize = true;
posY += 15;

Ok, everything works. Tag text is automatically wrapped after 400 pixels. The problem is that I need to create a second shortcut, but how do I know how to set the location? This new label should be placed just below the first label, and the first label can be 1 line or 5 lines long. Any help would be appreciated.

+3
source share
3 answers

try putting your shortcut in FlowLayoutPanel , set FlowDirection from top to bottom.

+4
source

, Int3, - Height 1 Top 2.

:

label2.Top = label1.Top + label1.Height + 10;
+1

GridLayout with some rows may be the solution

0
source

All Articles