如何增加DataGridView中的行大小
本文关键字:DataGridView 何增加 增加 | 更新日期: 2023-09-27 18:01:07
如何使用C#增加DataGridView中的行大小?我找不到这处房产。
提前谢谢。
您可以始终循环通过所有DataGridViewRow
并设置Height
属性:
foreach (DataGridViewRow row in dataGridView1.Rows) {
if (heightShouldBeSet) {
row.Height = yourHeightSetting;
}
}
您需要添加一个新行。
int n = dataGridView1.Rows.Add();
dataGridView1.Rows[n].Cells[0].Value = title;
dataGridView1.Rows[n].Cells[1].Value = dateTimeNow;
如果你想增加行高,你也可以在单元格值中增加空行。