3
我有一個帶有datagridview的vb.net窗體窗體應用程序。我希望能找到一種方法來改變datagridview中多列的寬度。這是我到目前爲止,但它只改變了第一列的寬度,而不是其餘。我感謝您可能給予的任何幫助。如何更改DataGridView列的寬度
Dim columnwidth1 As DataGridViewColumn = DataGridView1.Columns(0)
columnwidth1.Width = 100
Dim columnwidth2 As DataGridViewColumn = DataGridView1.Columns(1)
columnwidth2.Width = 100
Dim columnwidth3 As DataGridViewColumn = DataGridView1.Columns(2)
columnwidth3.Width = 100
Dim columnwidth4 As DataGridViewColumn = DataGridView1.Columns(3)
columnwidth4.Width = 100
您說得對,我偶然發生了autosizemode。非常感謝你的幫助!快樂編碼! – stackexchange12