Vyas Dev Vyas Dev - 1 year ago 148
C# Question

How to avoid flickering in TableLayoutPanel in c#.net

I am using a TableLayoutPanel for attendance marking purposes. I have added controls (a Panel and a Label) inside of this TableLayoutPanel and created events for them. In some conditions I have cleared all of the controls and proceeded to bind the same controls in different position of TableLayoutPanel. While re-binding the controls, the TableLayoutPanel flickers and is far too slow in initializing.

Ian Ian
Answer Source

Suspend the layout until you've added all your controls on.

TableLayoutPanel panel = new TabelLayoutPanel();

// add controls


Also look at using Double Buffering. You'll have to create a sub-class of the TableLayoutPanel. See an example here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download