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

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

Leave a Comment