I have an about 100 rows DataGridView which drops performance significantly since I wrote some code modifying its cells value programmatically. After looking up the MSDN post, the property AutoSizeColumnsMode is the reason why my DataGridView being slow. The property was set to AllCells, turns out it’ll auto resize cells when the value changes and that takes a lot of resource.
By 100 rows my code will run for about 1500 milliseconds. Changing the property to DisplayedCells can reduce it to 30 milliseconds and changing to ColumnHeader can reduce it to less than 8 milliseconds. It’ll cost no time if I commented the value changing code.
I guess every single cell value change will always auto resize according to the value of the AutoSize property, even when the property value is ColumnHeader.