C# datagridview 调整列宽,最小宽度,多了补充,不足有滚动条

 //调整列宽
                //重置所有列宽
                for (int i = 0; i < this.dgvStatus.Columns.Count; i++)
                {
                    this.dgvStatus.Columns[i].MinimumWidth = 100;
                }
                for (int i = 1; i < this.dgvStatus.Columns.Count; i++)
                {
                    this.dgvStatus.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                }

 

你可能感兴趣的:(C# datagridview 调整列宽,最小宽度,多了补充,不足有滚动条)