Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the DoubleBuffered property default to false on a DataGridView and why is it protected?

We had a performance issue with DataGridViews where the redraw was horridly slow and found the solution Here to create a derived type and enable double buffering on the control. (Derived type is necessary since the DoubleBuffered property is protected)

It doesn't seem like there's any drawback to having the DoubleBuffered property set to true.

like image 628
Karg Avatar asked Oct 31 '08 05:10

Karg


1 Answers

I think its best solution:

typeof(DataGridView).InvokeMember(
   "DoubleBuffered", 
   BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
   null, 
   myDataGridViewObject, 
   new object[] { true });

found here

like image 112
Dawid Moś Avatar answered Sep 24 '22 06:09

Dawid Moś