为什么 DataGridView 上的 DoubleBuffered 属性默认为 false,为什么它受到保护? [英] Why does the DoubleBuffered property default to false on a DataGridView and why is it protected?
本文介绍了为什么 DataGridView 上的 DoubleBuffered 属性默认为 false,为什么它受到保护?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们遇到了 DataGridViews 的性能问题,其中重绘速度非常慢,并找到了解决方案 此处 创建派生类型并在控件上启用双缓冲.(派生类型是必需的,因为 DoubleBuffered 属性是受保护的)
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)
将 DoubleBuffered 属性设置为 true 似乎没有任何缺点.
It doesn't seem like there's any drawback to having the DoubleBuffered property set to true.
推荐答案
我认为最好的解决方案:
I think its best solution:
typeof(DataGridView).InvokeMember(
"DoubleBuffered",
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty,
null,
myDataGridViewObject,
new object[] { true });
找到这里
这篇关于为什么 DataGridView 上的 DoubleBuffered 属性默认为 false,为什么它受到保护?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文