Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to align a serie of label / textbox vertically with flowlayoutpanel?

Tags:

winforms

I would like to align like this

label1 TextBox1
label2 TextBox2
label3 TextBox3

I set FlowDirection to TopDown but how can I do to align label1 with TextBox1 horizontally ?

like image 420
programmernovice Avatar asked Nov 30 '22 11:11

programmernovice


2 Answers

Yes, you can do it. You have to remove the anchors of each control. In a FlowLayoutPanel, no anchors means middle vertical alignment. I hope it helps.

like image 178
Francisco Goldenstein Avatar answered Dec 05 '22 01:12

Francisco Goldenstein


Use RightToLeft instead of TopBottom in the FlowLayoutPanel and set FlowBreak=True to each TextBox.
To align vertically Labels and TextBoxes, set Anchor=None on all of them (as @Francisco says below)

labels and textboxes aligned in a FlowLayoutPanel

like image 42
Ivan Ferrer Villa Avatar answered Dec 05 '22 00:12

Ivan Ferrer Villa