rfazendeiro
Centurion
- Joined
- Mar 8, 2004
- Messages
- 110
Hello to all,
I'm currently trying to add at runtime some rows to a Table Layout Panel. With the property RowCount i can add how many rows I need.
So for a test i put in a textbox and a botton and when the user clicks the button it creates the number of row indicated in the textbox and add somes controls to them.
My problem is the flickering that creating the rows in run time causes. How can i cause the flicking to desapear of at least lower it ?
here is a basic example to create the rows
I'm currently trying to add at runtime some rows to a Table Layout Panel. With the property RowCount i can add how many rows I need.
So for a test i put in a textbox and a botton and when the user clicks the button it creates the number of row indicated in the textbox and add somes controls to them.
My problem is the flickering that creating the rows in run time causes. How can i cause the flicking to desapear of at least lower it ?
here is a basic example to create the rows
C#:
private void fillData()
{
//Clear all the controls
tlpWarranty.Controls.Clear();
tlpWarranty.RowStyles.Clear();
tlpWarranty.AutoSize = true;
//Set the new count
tlpWarranty.RowCount = Convert.ToInt16(textBox1.Text);
for (int i = 0; i < tlpWarranty.RowCount; i++)
{
tlpWarranty.RowStyles.Add(new RowStyle(SizeType.AutoSize, 100));
Label lblLabel = new Label();
lblLabel.Text = "Label control: " + i.ToString();
lblLabel.Font = new Font("Verdana", 8, FontStyle.Bold | FontStyle.Regular);
lblLabel.AutoSize = true;
Label lblData = new Label();
lblData.Text = "Data for entity (" + i.ToString() + ")";
lblData.Font = new Font("Verdana", 8, FontStyle.Regular);
lblData.AutoSize = true;
tlpWarranty.Controls.Add(lblLabel, 0, i);
tlpWarranty.Controls.Add(lblData, 1, i);
}
}