DataGridView減少閃爍的解決辦法

Reducing flicker, blinking in DataGridView

http://www.codeproject.com/Tips/390496/Reducing-flicker-blinking-in-DataGridView

One of my project requirement was to create a Output Window similar to Visual Studio. For that I used aDataGridView. But when I start my application, I found that there is lot of blinking, flicker, pulling... After badly hitting my head with Google, I found a very easy way. We just need to create a extension method to DataGridView and it's all done:

 Collapse | Copy Code

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); 
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章