Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

DataGridView - efficiently add row & column header indices

$
0
0

Hi,

I'm developing a VSPackage (extension for Visual Studio 2010), and I have a tool window that is hosting a DataGridView control.

I have a very large data-set (e.g. 2D array of size 16384 x 16384) that I wish to display on the grid, and I update the data in the view via VirtualMode.

I want to add index to the row header cells and column header cells, so I tried the following:

  1. Auto resize via grid methods
  1. grid.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders);

  2. Iterating through each row & updating:

  1. foreach(DataGridViewRow row in grid.Rows){
       row.HeaderCell.Value=(row.Index+1).ToString();}

3. Subscribing to RowsAdded/OnPaint and updating the value there.

But, all these methods were SUPER SLOW!

They significantly degraded the rendering of the DGV (takes like ~ 5 seconds or more to render the view after each of these methods, or even worse).

What would you suggest to do instead?

Thanks,

Ofir


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>