DataGridView::AutoResizeColumns Method
.NET Framework (current version)
Adjusts the width of all columns to fit the contents of their cells.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
| Name | Description | |
|---|---|---|
![]() | AutoResizeColumns() | Adjusts the width of all columns to fit the contents of all their cells, including the header cells. |
![]() | AutoResizeColumns(DataGridViewAutoSizeColumnsMode) | Adjusts the width of all columns using the specified size mode. |
![]() | AutoResizeColumns(DataGridViewAutoSizeColumnsMode, Boolean) | Adjusts the width of all columns using the specified size mode, optionally calculating the widths with the expectation that row heights will subsequently be adjusted. |
Show:

