DataGridView: Set AutoSizeRowsMode only for certain rows

97 Views Asked by At

I am currently creating my own DataGridViewRow (called DataGridViewMultiRow), and I want to set only those rows in the DGV to auto-height that are not of the type of my new class.

I have not found a good solution to this yet. My workaround is to fill the multi-row cells with the same merged data that I will draw manually (I will draw in a different way, so this still has its use), ensuring that the auto-height calculates the correct height.
If auto-height is off, then my PaintRow() that hooks on DGV.RowPrePaint event sets the height directly.

Another (ugly) workaround could be subscribing to a suitable DGV event and calling AutoResizeRow() on each DGVR.

Is there a way to apply auto-height settings ony to certain rows?

0

There are 0 best solutions below