1

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.

  • Do I use too much autosizing?
  • Or is my Panel too nested?
Verena Haunschmid
  • 1,252
  • 15
  • 40
  • Possible duplicate of [TableLayoutPanel responds very slowly to events](https://stackoverflow.com/questions/8900099/tablelayoutpanel-responds-very-slowly-to-events) – Jim Fell Mar 07 '19 at 22:58

1 Answers1

7

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.

Community
  • 1
  • 1
MukeshAnAlsoRan
  • 671
  • 2
  • 6
  • 13