I did what I could think of to speed up the rendering (mainly around optimising data access) but couldn't get the rendering time down. Then I Googled it, and it appears that I'm not the first developer to have this problem; the DataGridView is notoriously slow to render. The annoying part is that the problem is so easy to fix - set the grid's DoubleBuffered property on.
This property is protected, so you need to either use Reflection to set it on your grid instance, or create a specialised DataViewGrid. I created a DoubleBufferedDataGridView:
It's so easy to fix, it seems odd that DoubleBuffered is not set to true by default, but hey.
The code for the sample form above is available as a GitGist
No comments:
Post a Comment