How to calculate dgv.Rows.Height
int x = dgv1.Rows.Height
Rows.Height or dgv1.RowsHeight does not exists.
Row heights can vary, so try the row you want:
int x = dgv1.Rows[0].Height;
Alternatively, I think it's also available from the template:
int x = dgv1.RowTemplate.Height;
If you want the combined height of the column header and all the rows, try:
int x = dgv1.ColumnHeadersHeight + dgv1.Rows.Cast<DataGridViewRow>().Sum(r => r.Height);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With