Column width of the DataGridView winform

DataGridView has a property AutoSizeColumnMode, he has a lot enumeration values:

1, AllCells adjust the column widths to fit the contents of all cells in the column, including the header cell.  
2, AllCellsExceptHeader adjust the column widths to fit the contents of each cell of the column, not including the header cell.  
3, ColumnHeader adjust the column width to fit content column header cells.  
4, DisplayedCells adjust the column widths to fit the contents of each cell of the column of the row currently displayed on the screen, including the header cell.  
5, DisplayedCellsExceptHeader adjust the column widths to fit the contents of each cell of the column of the row currently displayed on the screen, not including the header cell.  
6, Fill adjust the column width, the width of all columns exactly fills the display area of the control, to ensure that only horizontal scrolling listed above DataGridViewColumn.MinimumWidth width attribute value. Relative column width is determined by the relative DataGridViewColumn.FillWeight attribute value.  
7, None column width is not automatically adjusted.  
8, column resizing behavior NotSet inherited from DataGridView.AutoSizeColumnsMode property.

 
 

Guess you like

Origin www.cnblogs.com/wfy680/p/12005529.html