Flickering during updates to Controls in WinForms (e.g. DataGridView)

前端 未结 8 1731
悲哀的现实
悲哀的现实 2021-01-05 10:43

In my application I have a DataGridView control that displays data for the selected object. When I select a different object (in a combobox above), I need to update the grid

8条回答
  •  一生所求
    2021-01-05 11:41

    The .NET control supports the SuspendLayout and ResumeLayout methods. Pick the appropriate parent control (i.e. the control that hosts the controls you want to populate) and do something like the following:

    this.SuspendLayout();
    
    // Do something interesting.
    
    this.ResumeLayout();
    

提交回复
热议问题