How to calculate dgv.Rows.Height
int x = dgv1.Rows.Height
Rows.Height or dgv1.RowsHeight does not exist.
The height of the lines can vary, so try the line you want:
int x = dgv1.Rows[0].Height;
Alternatively, I think it is also available from the template:
int x = dgv1.RowTemplate.Height;
If you need a combined column header height and all rows, try:
int x = dgv1.ColumnHeadersHeight + dgv1.Rows.Cast<DataGridViewRow>().Sum(r => r.Height);