Reputation: 9407
Excuse me, a quick question:
I am using this routine to display a list of strings into a datagridview:
List<string> MyDataSource = MyList.Select(x => Path.GetFileNameWithoutExtension(x)).ToList();
AllVideosGrid.DataSource = MyDataSource.ConvertAll(x => new { Value = x });
Designer generated code:
// 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;
And it gets displayed like this:
I would like rows to be resized to the datagridview size that I set initially in my designer. How can I do that?
Upvotes: 0
Views: 36
Reputation: 62
for horizontal strecth use this:
this.AllVideosGrid.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
For vertical I think that's not possible, eventually you can set the height for each row
Upvotes: 1