Resizing Columns and Rows in the Windows Forms DataGridView Control
The DataGridView control provides numerous options for customizing the sizing behavior of its columns and rows. Typically, DataGridView cells do not resize based on their contents. Instead, they clip any display value that is larger than the cell. If the content can be displayed as a string, the cell displays it in a ToolTip.
By default, users can drag row, column, and header dividers with the mouse to show more information. Users can also double-click a divider to automatically resize the associated row, column, or header band based on its contents.
The DataGridView control provides properties, methods, and events that enable you to customize or disable all of these user-directed behaviors. Additionally, you can programmatically resize rows, columns, and headers to fit their contents, or you can configure them to automatically resize themselves whenever their contents change. You can also configure columns to automatically divide the available width of the control in proportions that you specify.
In This Section
Describes the options for sizing rows, columns, and headers. Also provides details on sizing-related properties and methods, and describes common usage scenarios.
Describes column fill mode in detail, and provides demonstration code that you can use to experiment with column fill mode and other modes.
Describes how to configure the sizing modes for common purposes.
Provides demonstration code that you can use to experiment with programmatic resizing.
Provides demonstration code that you can use to experiment with automatic sizing modes.
Provides reference documentation for the DataGridView control.