
Use column fill mode to avoid displaying the control background. Set large MinimumWidth values for columns that must always display some of their data or use a sizing option other than fill mode for specific columns. Set the AutoSizeColumnsMode property to Fill. Use column fill mode with values of varying importance. Initialize relative column widths by setting the column FillWeight properties or by calling the control AutoResizeColumns method after filling the control with data. Use column fill mode with display values of varying sizes. Use column fill mode for displaying similarly sized data in a relatively small number of columns that occupy the entire width of the control without displaying the horizontal scroll bar. The following table shows scenarios that you can use to adjust the default behavior or to use specific sizing options to achieve particular effects. You can also set specific height and width values.īy default, user resizing is enabled, automatic sizing is disabled, and cell values that are wider than their columns are clipped. Programmatic content-based resizing lets you make opportunistic size adjustments based on cell values at the time of the method call. In content-based automatic sizing modes, sizes change to fit new display values.

In column fill mode, column widths change when the control width changes for example, when the control is docked to its parent form and the user resizes the form. Users can make size adjustments by dragging or double-clicking row, column, or header dividers. The following table shows these occurrences.

DataGridView rows, columns, and headers can change size as a result of many different occurrences.
