Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

 

       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);
           }
       }

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...