Dim RowHeight As Integer '行高
Dim DataGridHeight As Integer '网格的总高度
Dim Rows As Integer '计算出来的行数
Dim X As Integer '显示行以外的自己慢慢调吧
DataGridView1.AllowUserToResizeRows = False
RowHeight = DataGridView1.CurrentCell.OwningRow.Height
DataGridHeight = DataGridView1.Bounds.Height
Rows = (DataGridHeight - X) / RowHeight