问题
Hi i am using the DataGridView in the C#.Net 3.5 and i want the height of the all row is set to Autosize.. i have defined the WrapMode = true but not getting the Height Autosize
So plz guide me
Thanks
回答1:
DataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
See http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autosizerowsmode.aspx
回答2:
if you want to change only for particular row :
int j = Rowindex;
datagridview1.AutoResizeRow(j, DataGridViewAutoSizeRowMode.AllCells);
回答3:
DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
is a better choice, if you want to keep same width of columns.
来源:https://stackoverflow.com/questions/3948097/datagridview-row-height-autosize