编程语言
首页 > 编程语言> > C# DataGridView 刷新导致界面卡顿解决办法

C# DataGridView 刷新导致界面卡顿解决办法

作者:互联网

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

标签:C#,DataGridView,dgvType,dataGridView1,ControlStyles,pi,true,卡顿
来源: https://www.cnblogs.com/leowindy/p/15961521.html