I am filling the datagridview with data and the data is not completely visible in each cell. How can I show all content which even has Enter Keys in it.
问问题
6878 次
2 回答
3
这将完全显示单元格内容。
DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;
于 2013-07-11T17:19:18.990 回答
2
继续你上面的评论试试这样
With DataGridView1.Columns("Message")
.Width = 150
.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells
.DefaultCellStyle.WrapMode = DataGridViewTriState.True
End With
编辑:
// Resize the master DataGridView columns to fit the newly loaded data.
masterDataGridView.AutoResizeColumns();
// Configure the details DataGridView so that its columns automatically
// adjust their widths when the data changes.
private void SizeAllColumns(Object sender, EventArgs e)
{
dataGridView1.AutoResizeColumns(
DataGridViewAutoSizeColumnsMode.AllCells);
dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.Fill);
}
于 2013-07-08T12:24:00.480 回答