Hi christing,
为了正确设置 datagridview 的宽和高,你可以使用
DataGridView.RowTemplate 属性和
DataGridView.RowsAdded 事件来完成。
我做了一个测试,你可以参考以下测试内容:
Private dt As DataTable = New DataTable()
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
dt.Columns.Add("id")
dt.Columns.Add("name")
dt.Columns.Add("age")
dt.Rows.Add(1, "A", 20)
dt.Rows.Add(2, "B", 21)
dt.Rows.Add(3, "C", 21)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
DataGridView1.RowTemplate.Height = 50
DataGridView1.DataSource = dt
End Sub
Private Sub DataGridView1_ColumnAdded(sender As Object, e As DataGridViewColumnEventArgs) Handles DataGridView1.ColumnAdded
e.Column.Width = 50
End Sub
测试结果:

Best Regards,
Xingyu Zhao
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.