Net Core教程

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 刷新导致界面卡顿解决办法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!