I have a virtual datagridview that I want to set varying row heights for. I was hoping to find a method for setting all the row heights at once, rather than looping through each one at a time.
This is the method that I tried to set the heights, but the performance is horrible ~1 second per 1,000 rows. For me, an average row count is ~20k-30k rows so this is unacceptable.
public void PopulateData()
{
this.SuspendLayout();
this.RowCount = Data.RowCount;
for (int i = 0; i < Data.RowCount; i++)
{
this.Rows[i].Height = Data.RowHeights[i];
}
this.ResumeLayout();
}
I made sure to turn off auto-sizing first also, but performance is still poor.
this.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None;
this.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None;
Is there any way to pass in an array of row heights or prevent OnRowHeightChanged
from being called when resizing rows?