I have a Label whose length changes as the program runs (the text is modified). And I am trying to set side-by-side this Label and an PictureBox. To do so, I did put them into a FlowLayoutPanel.
The problem is then that the two elements are not vertically aligned: they have different height.
I did not find a VerticalAlign property in the FlowLayoutPanel nor did I manage to modify the height of my Label (changing the font size is not an option).
Any suggestion?
I’m not 100% clear on what you’re trying to accomplish, but I believe I found a way to get this to align how you want.
TableLayoutPanel, make it 2 columns, 1 row.Labelto the left cell, set it to Dock: Fill. Also set TextAlign: MiddleLeft.PictureBoxto the right cell. Set the Anchor to None.This should give you a label on the left and a
PictureBoxon the right that will always be vertically centered. Modify the properties of theTableLayoutPanelaccording to your needs.