How can I make a Winforms datagridview expand column widths to fit content?
I need my开发者_如何学Python columns to be only as big as the largest value in that column.
Is there a setting somewhere I can set?
Thank you.
You can set the AutoSizeColumnsMode
property to DataGridViewAutoSizeColumnsMode.AllCells
(or the appropriate value for you). Or call AutoResizeColumns()
to resize the columns as you need it.
精彩评论