在知道此方法之前,我是给窗口增加事件来实现的动态计算各行长度
之所以是没有Columns[0] 是因为该列为隐藏,不能实现比例分配
this.dgvMainTable.Columns[1].FillWeight = 7; this.dgvMainTable.Columns[2].FillWeight = 13; this.dgvMainTable.Columns[3].FillWeight = 7; this.dgvMainTable.Columns[4].FillWeight = 20; this.dgvMainTable.Columns[5].FillWeight = 7; this.dgvMainTable.Columns[6].FillWeight = 7; this.dgvMainTable.Columns[7].FillWeight = 7; this.dgvMainTable.Columns[8].FillWeight = 7; this.dgvMainTable.Columns[9].FillWeight = 10; this.dgvMainTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;