Context: I'm using a flowlayoutpanel to dynamically add controls to a form.
Question: Why does setting margins on each control as I'm doing using the code below, not change how my controls appear in the attached image?
Thoughts: Using the code below should force the label and textbox to be right next to each other. It is my understanding that the margins are what affect the distance between each item for layout in a flowlayoutpanel.
// Create the control instances.
var textBox = new TextBox();
var nameLabel = new Label();
// Setup options for controls.
textBox.Size = new System.Drawing.Size(175, 20);
textBox.Margin = new Padding(0, 0, 0, 0);
nameLabel.Text = parameter.ParameterName;
nameLabel.Margin = new Padding(0, 0, 0, 0);
// Add controls to the flow panel.
flowLayoutPanel1.Controls.Add(nameLabel);
flowLayoutPanel1.Controls.Add(textBox);
Rerferences:
Align dynamically added controls horizontally and vertically within a control in c# winforms