많은 양의 데이터를 보여줄때 깜빡임이 있을 때에는 더블버퍼링을 이용합니다.

 

Contorl 클래스의 DoubleBuffered 속성을 true로 주면 됩니다.

 

    public class ExtendGridView : DataGridView     {         public ExtendGridView()         {             base.DoubleBuffered = true;         }     }

 

 

 

 

DoubleBuffred 속성이 protected 인지라 상속을 받아야 하는데 리플렉션을 이용해서 간단히 속성을 변경 할 수 있습니다.

 

    using System.Reflection;     using System.Windows.Forms;     public static class ControlHelper     {         /// <summary>         /// 컨트롤의 DoubleBuffered 속성을 변경합니다.         /// </summary>         /// <param name="contorl"></param>         /// <param name="setting"></param>         public static void SetDoubleBuffered(this Control contorl, bool setting)         {             Type dgvType = contorl.GetType();             PropertyInfo pi = dgvType.GetProperty("DoubleBuffered"BindingFlags.Instance | BindingFlags.NonPublic);             pi.SetValue(contorl, setting, null);         }     } 

 

+ Recent posts