对不起,一个简单的问题:如何将datagridview的行/列宽设置为datagridview的宽度?
我使用这个程序来显示字符串列表到一个DataGridView:
List<string> MyDataSource = MyList.Select(x => Path.GetFileNameWithoutExtension(x)).ToList();
AllVideosGrid.DataSource = MyDataSource.ConvertAll(x => new { Value = x });
设计器生成的代码:
// MyGrid
//
this.AllVideosGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.AllVideosGrid.Location = new System.Drawing.Point(33, 185);
this.AllVideosGrid.Name = "AllVideosGrid";
this.AllVideosGrid.RowTemplate.Height = 24;
this.AllVideosGrid.Size = new System.Drawing.Size(319, 498);
this.AllVideosGrid.TabIndex = 32;
而且它还有显示像这样:
我想要将行的大小调整为我在设计器中初始设置的datagridview大小。我怎样才能做到这一点?
? – kennyzx
@kennyzx哦,对,。编辑!谢谢 –
尝试AutoSizeColumnsMode填充 – kennyzx