일반

doublebuffer

알 수 없는 사용자 2022. 2. 21. 14:41
SMALL

using System.Reflection; // 더블버퍼링 하기 위해서 추가

 

namespace 네임스페이스이름
{
    public partial class Form1 : Form
    {
        public formReservation()
        {
            InitializeComponent();

 

            dataGridView1.DoubleBuffered(true);       // 확장하기

        }

    }

 

   
    public static class ExtensionMethods    // DoubleBuffered 메서드를 확장
    {
        public static void DoubleBuffered(this DataGridView dgv, bool setting)
        {
            Type dgvType = dgv.GetType();
            PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetProperty);
            pi.SetValue(dgv, setting, null);
        }
    }

} 네임스페이스 닫기

LIST