In my grid I had following line of code which disabled user’s manual resizing:
dgvTruckAvail.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
Now I needed to set column height in code and it didn’t work (see DataGridView setting row height doesn't work)
I figured that it was this line of code that caused non-sizing issue. However, now I need to figure out how to
- Size rows in code
and
- Prevent user sizing rows themselves
Any pointers?
Set:
This will disable row autosizing and manual row resizing. To set the row height you can use the
HeightandMinimumHeightproperties of theRowTemplate.