TableLayout Panel – Problems and Solutions

If you have used TableLayoutPanel ( in .NET 2.0 ) you must have faced with excessive flickers when drawing several table layout panels.

Here I am posting some I had faced along with the solutions .

1) Creating multiple TableLayoutPanel objects

foreach(TableLayoutPanelobj in TableLayoutPanelList)
obj.SuspendLayout() ;

// code for your drawing goes here

foreach(TableLayoutPanelobj in TableLayoutPanelList)
obj.ResumeLayout() ;


ResumeLayout has a default parameter set to true, hence it also calls PerformLayout.

2) The above solution shall still have some flickers , here is the solution to remove that

Create a class which inherits from TableLayoutPanel, like the one below .

class MyTableLayout : public TableLayoutPanel
{
MyTableLayout( )
{
this.DoubleBuffered = true ;
}
}
Use the MyTableLayout object in your classes , there shall be no flicker .
Follow

Get every new post delivered to your Inbox.