DatagridView: Remove unused space?

前端 未结 8 1228
-上瘾入骨i
-上瘾入骨i 2021-01-11 15:25

I was wondering whether it is possible to remove the unused space ( the gray space ) of the DataGridView control in C#. I have to make the DataGridView

8条回答
  •  长发绾君心
    2021-01-11 16:08

    I use this code for and it works for my if you don't add a button column or image I take it from a site but I don't remember from where :

    For Each row As DataGridViewRow In DataGridView1.Rows
    If datagrid_limits > newHeight Then
    newHeight =newHeight + 40
    Else
    Exit For
    End If
    Next
    DataGridView1.Height = newHeight
    

提交回复
热议问题