添加项目文件。
This commit is contained in:
18
WinFormsApp1/FastDataGridView.cs
Normal file
18
WinFormsApp1/FastDataGridView.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
|
||||
public class FastDataGridView : DataGridView
|
||||
{
|
||||
public FastDataGridView()
|
||||
{
|
||||
// 通过反射开启 DataGridView 的 DoubleBuffered 属性
|
||||
typeof(DataGridView)
|
||||
.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic)
|
||||
.SetValue(this, true, null);
|
||||
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user