본문 바로가기
C#.Net

DataGridview 데이터 추가 시 깜빡임 해결

by 호야호잇 2024. 7. 3.
*참조 선언

using System.Reflection;



// 클래스 선언

public static class ControlHelper

    {

        public static void SetDoubleBuffered(this DataGridView ctrl, bool setting)

        {

            Type dgvType = ctrl.GetType();

            PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);

            pi.SetValue(ctrl, setting, null);

        }

    }



// 호출방법

dataGridView1.SetDoubleBuffered(true);