Represents the formatting and style information applied to individual cells within a DataGridView control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Thetype exposes the following members.
|Alignment||Gets or sets a value indicating the position of the cell content within a DataGridView cell.|
|BackColor||Gets or sets the background color of a DataGridView cell.|
|DataSourceNullValue||Gets or sets the value saved to the data source when the user enters a null value into a cell.|
|Font||Gets or sets the font applied to the textual content of a DataGridView cell.|
|ForeColor||Gets or sets the foreground color of a DataGridView cell.|
|Format||Gets or sets the format string applied to the textual content of a DataGridView cell.|
|FormatProvider||Gets or sets the object used to provide culture-specific formatting of DataGridView cell values.|
|IsDataSourceNullValueDefault||Gets a value indicating whether the DataSourceNullValue property has been set.|
|IsFormatProviderDefault||Gets a value that indicates whether the FormatProvider property has been set.|
|IsNullValueDefault||Gets a value indicating whether the NullValue property has been set.|
|NullValue||Gets or sets the DataGridView cell display value corresponding to a cell value of DBNull.Value or a null reference (Nothing in Visual Basic).|
|Padding||Gets or sets the space between the edge of a DataGridViewCell and its content.|
|SelectionBackColor||Gets or sets the background color used by a DataGridView cell when it is selected.|
|SelectionForeColor||Gets or sets the foreground color used by a DataGridView cell when it is selected.|
|Tag||Gets or sets an object that contains additional data related to the .|
|WrapMode||Gets or sets a value indicating whether textual content in a DataGridView cell is wrapped to subsequent lines or truncated when it is too long to fit on a single line.|
|ApplyStyle||Applies the specified to the current .|
|Clone||Creates an exact copy of this .|
|Equals||Returns a value indicating whether this instance is equivalent to the specified object. (Overrides Object.Equals(Object).)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Overrides Object.GetHashCode().)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ToString||Returns a string indicating the current property settings of the . (Overrides Object.ToString().)|
The class lets you share style information across multiple DataGridView cells, rows, columns, and row or column headers, avoiding the memory requirements of setting style properties on individual cells. For more information about classes that have a property of type and how they relate to each other, see Cell Styles in the Windows Forms DataGridView Control.
The following code example demonstrates the effect of setting properties on multiple objects. This example sets the background color of cells in the DataGridView by setting the BackColor property on the DefaultCellStyle property. The background color is overridden on alternating rows because the BackColor property is set on the AlternatingRowsDefaultCellStyle property. The example also determines the format of dates in the column named Last Prepared by setting the Format property on the column's DefaultCellStyle property.