30 5.3.1 Sizing Options in the Windows Forms Data Grid View Control 30 5.3.2 Resizing with the Mouse. If you explicitly set Resizable to True or False, however, the specified value overrides the control value is for that row or column.
28 5.2.2 Row Pre Paint and Post Paint 29 5.3 Autosizing. 33 5.3.5 Customizing Content-based Sizing Behavior. By default, the Resizable property value is based on the Allow User To Resize Columns property value for columns and the Allow User To Resize Rows property value for rows.
If content-based automatic sizing is enabled for one dimension only—that is, for rows but not columns, or for columns but not rows—and Wrap Mode is also enabled, size adjustment also occurs whenever the other dimension changes.
The value of this property is based on the column's Auto Size Mode property value unless that value is Not Set, in which case the control's Auto Size Columns Mode value is inherited. Column fill mode causes the visible columns in the control to fill the width of the control's display area. There are two kinds of automatic sizing in the Data Grid View control: column fill mode and content-based automatic sizing. With these values, you can limit which cells are used to calculate the preferred sizes. The enumerations used by sizing properties and methods have similar values for content-based sizing. You can customize sizing behaviors when working with derived Data Grid View cell, row, and column types by overriding the Data Grid View Cell. The protected resizing method overloads are designed to work in pairs to achieve an ideal cell height-to-width ratio, avoiding overly wide or tall cells. For example, you might programmatically resize all columns immediately after loading data, or you might programmatically resize a specific row after a particular cell value has been modified. Get Preferred Width() methods or by calling protected resizing method overloads in a derived Data Grid View control. You will typically call the programmatic resizing methods at specific times. It is also useful to provide initial sizes for user-resizable rows, columns, and headers, and for column fill mode. The sizing mode for a column is actually determined by its Inherited Auto Size Mode property. To configure the sizing mode for headers and rows and for columns that do not override the control value, set one or more of the following Data Grid View properties: To override the control's column sizing mode for an individual column, set its Auto Size Mode property to a value other than Not Set.