1 class DoubleBufferDataGridView : DataGridView 2 { 3 public DoubleBufferDataGridView() 4 { 5 SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); 6 //UpdateStatus.Continue; 7 UpdateStyles(); 8 } 9 }
调用方法:
在InitializeComponent()函数中
// this.dataGridView1 = new System.Windows.Forms.DataGridView(); 屏蔽掉,添加下面这句即可
this.dataGridView1 = new DoubleBufferListView();
时间: 2024-10-17 08:41:43