DataGridView Row Height Autosize

2019-02-11 12:19发布

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

3条回答
我欲成王,谁敢阻挡
2楼-- · 2019-02-11 12:49

if you want to change only for particular row :

 int j = Rowindex;
 datagridview1.AutoResizeRow(j, DataGridViewAutoSizeRowMode.AllCells);
查看更多
啃猪蹄的小仙女
3楼-- · 2019-02-11 13:08

DataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells

See http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.autosizerowsmode.aspx

查看更多
叛逆
4楼-- · 2019-02-11 13:11

DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;

is a better choice, if you want to keep same width of columns.

查看更多
登录 后发表回答