DataGridView Row Height Autosize

拥有回忆 提交于 2019-11-30 01:03:15

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!