Horrible redraw performance of the DataGridView on one of my two screens

后端 未结 9 1916
情话喂你
情话喂你 2020-11-28 03:30

I\'ve actually solved this, but I\'m posting it for posterity.

I ran into a very odd issue with the DataGridView on my dual-monitor system. The issue manifests its

相关标签:
9条回答
  • 2020-11-28 04:11

    Just to add what we did to fix this issue: We upgraded to the latest Nvidia drivers solved the problem. No code had to be rewritten.

    For completeness, the card was an Nvidia Quadro NVS 290 with drivers dated March 2008 (v. 169). Upgrading to the latest (v. 182 dated Feb 2009) significantly improved the paint events for all my controls, especially for the DataGridView.

    This issue was not seen on any ATI cards (where development occurs).

    0 讨论(0)
  • 2020-11-28 04:17

    You just need to make a custom class based off of DataGridView so you can enable its DoubleBuffering. That's it!

    
    class CustomDataGridView: DataGridView
    {
        public CustomDataGridView()
        {
            DoubleBuffered = true;
        } 
    }
    

    As long as all of my instances of the grid are using this custom version, all is well. If I ever run into a situation caused by this where I'm not able to use the subclass solution (if I don't have the code), I suppose I could try to inject that control onto the form :) (although I'll be more likely to try using reflection to force the DoubleBuffered property on from the outside to once again avoid the dependency).

    It is sad that such a trivially simple thing ate up so much of my time...

    Note: Making the answer an answer so the question can be marked as answered

    0 讨论(0)
  • 2020-11-28 04:18

    I found a solution to the problem. Go to troubleshoot tab in the advanced display properties and check the hardware acceleration slider. When I got my new company PC from IT, it was set to one tick from full and I didn't have any problems with datagrids. Once I updated the video card driver and set it to full, painting of datagrid controls became very slow. So I reset it back to where it was and the problem went away.

    Hope this trick works for you as well.

    0 讨论(0)
提交回复
热议问题