I am using a DataGridView
in C# .NET 3.5 and I want the height of all rows set to AutoSize
.
I set WrapMode = true
but am still not getting the height to autosize.
I am using a DataGridView
in C# .NET 3.5 and I want the height of all rows set to AutoSize
.
I set WrapMode = true
but am still not getting the height to autosize.
DataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
See http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autosizerowsmode.aspx
if you want to change only for particular row :
int j = Rowindex;
datagridview1.AutoResizeRow(j, DataGridViewAutoSizeRowMode.AllCells);
DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
is a better choice, if you want to keep same width of columns.
DataGridViewAutoSizeRowsMode
does not have a definition for DisplayedCellsExceptHeaders
it must be AllCellsExceptHeaders
. –
Arsenal Setting the "DefaultCellStyle" -> WrapMode = true in Design, easy!
© 2022 - 2025 — McMap. All rights reserved.