I’m trying to create a buttons dynamically and add them to table layout panel the problems is that no matter what i do i keep having a vertical scrollbar even if i have only one row of buttons.
Code :
private void button2_Click(object sender, EventArgs e)
{
for (int i = 0; i < 50; i++)
{
Button button = new Button();
// button.Location = new Point(20, 30 * i + 10);
button.Click += new EventHandler(ButtonClick);
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
tableLayoutPanel1.ColumnCount += 1;
tableLayoutPanel1.Controls.Add(button);
}
}
Result :

I want to get rid of it the horizontal one is ok
Thanks in advance
Try adding the height of the horizontal scrollbar to the padding of the control: