Reputation: 1272
I have some TableLayoutPanel, where the first "layer" has 1 column and ten rows, some of this rows contain either a UserControl or another TableLayoutPanel with 2 or 3 columns and some rows. One or two of them contain another TableLayoutPanel, but that's it. So that's a maximum of 3 "levels" of nested TableLayoutPanels. Most of these are set to autosize, because some UserControls might change their size. When a form containing such a nested TableLayoutPanel, the UserControls "flicker", it looks like they are loading very slowly.
Upvotes: 2
Views: 8633
Reputation: 671
I don't think the flicker has to do anything with 'auto-sizing' or 'nested panels'.
Please refer another 'S-O' link : How to avoid flickering in TableLayoutPanel in c#.net
Suspend the layout until you've added all your controls on.
TableLayoutPanel panel = new TabelLayoutPanel();
panel.SuspendLayout();
// NOW add controls (including nested-controls) -- do autosizing etc
panel.ResumeLayout();
Also look at using Double Buffering. You'll have to create a sub-class of the TableLayoutPanel
. See an example.
Hope this helps.
Upvotes: 7