Prevent redrawing of controls on resize for Windows Forms

前端 未结 3 1732
[愿得一人]
[愿得一人] 2021-01-01 07:00

I have a TableLayoutPanel which holds a dynamic number of controls inside a SplitterPanel. A user may want to resize the panel to fit these Controls to avoid use of a scrol

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-01 07:48

    For me it worked well with making the TableLayoutPanel double-buffered, then I didn't even need to suspend the layout. I found the solution on this thread: How to avoid flickering in TableLayoutPanel in c#.net using the double-buffered TableLayoutPanel class from this website: https://www.richard-banks.org/2007/09/how-to-create-flicker-free.html

    After that all I needed to do was, after rebuilding the project and restarting Visual Studio a couple of times (to get the InitializeComponent()s working), go inside the .Designer.cs file and change the System.Windows.Forms.TableLayoutPanel class to the new DBLayoutPanel class. To go inside the Designer file and change the class there helped me save time because I already had a lot of controls inside the TableLayoutPanel.

提交回复
热议问题