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 .
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: