We have a DataGridView which has 2048 columns. We must provide a way for the user to increase and decrease the width of all columns in the DataGridView.
Currently, we do the following in a button click handler:
for (int i = 0; i < dgv.Columns.Count; i++)
{
dgv.Columns[i].Width += 5;
}
But that takes a while! (around 2 seconds to be more specific). (Note: We set the ColumnHeadersHeightSizeMode property to DataGridViewColumnHeadersHeightSizeMode.DisableResizing to gain some performance, but that doesn't cut it)
Is there a faster way to achieve the column resizing?