简体   繁体   中英

How do I stop the datagridview from violently repainting when a user clicks on a cell that was not initially visible?

I have a datagridview that is horizontally large. A good portion of it must be scrolled to in order for the user to see it. Curiously, whenever someone first clicks on a cell that wasn't in the group of 'originally visible cells', the datagridview decides to repaint itself. This might not have been a huge problem, but for this datagridview the repainting is really slow and noticeable.

The second click and all subsequent clicks on a particular cell will not cause the repaint.

Does anyone know how to calm the datagridview down?

Thanks!

To fix this, I just had to add DoubleBuffered = true to the constructor of my subclassed Datagridview.

Thanks to this guy:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM