Question : DataGridView in Virtual Mode flickers when adding rows.

Hello Community,

I'm fighting against a .NET 2.0 DataGridView in Virtual Mode. I'm handling its CellValueNeeded event providing data it has to show. Everything is working fine, but there is an anoying thing... When I periodically add additional rows to the DataGridView (by calling its Rows.Add() method) the entire view flickers and the cpu load rises about 10%. It flickers even if the view does not show any freshly added data!

In my oppinion DataGridView's internal row collection is changed when a row is added to the collection which results in the entire view to repaint.

Can anyone tell me how I can eliminate repainting the view in this case?

Thank you in advance!

Metacrawler

Answer : DataGridView in Virtual Mode flickers when adding rows.


With double-buffering, an enhancement you can try is to enable it only when adding, after adding you can disable, so that scrolling and other user operations will not delay....this is just a thought..you can try and see if it works..

Moreover on cpu usage, I tried switching between 3 browser windows and 2 VS windows by clicking on them in the task bar so that they will repaint themselves and I watched the cpu usage...it comes between 8-11% (once it came to 20% but only once and in another case 5% once among several rounds of clicking)...Try this and see how it shows for you...to get some understanding.

Random Solutions  
 
programming4us programming4us