public FrmSearch() { //设置窗体的双缓冲 this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); InitializeComponent(); //利用反射设置DataGridView的双缓冲 Type dgvType = this.dataGridView1.GetType(); PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic); pi.SetValue(this.dataGridView1, true, null); }
参考出处:https://www.cnblogs.com/HandLoong/p/8398714.html