昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期四, 六月 10, 2010

win7 datagridview scroll problem.


My app works fine in xp. 

Recently, we moved to win7. 

The datagridview refresh very slow when we scroll the scrollbar. 

To solve this issue, do this:



  public static class ExtensionMethods {     public static void DoubleBuffered(this DataGridView dgv, bool setting)     {         Type dgvType = dgv.GetType();         PropertyInfo pi = dgvType.GetProperty("DoubleBuffered",             BindingFlags.Instance | BindingFlags.NonPublic);         pi.SetValue(dgv, setting, null);     } }
  
  dataGridView1.DoubleBuffered(true);


--
Feng

没有评论:

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.