【发布时间】:2017-04-22 00:14:29
【问题描述】:
对不起,一个简单的问题:
我正在使用此例程将字符串列表显示到 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 哦,对,。编辑!谢谢
-
试试 AutoSizeColumnsMode 填充
-
@kennyzx 工作!谢谢
标签: c# winforms datagridview windows-forms-designer