System.Windows.Forms.DataGridView.DefaultCellStyle Property

Gets or sets the default cell style to be applied to the cells in the System.Windows.Forms.DataGridView if no other cell style properties are set.

Syntax

[System.ComponentModel.AmbientValue(null)]
public DataGridViewCellStyle DefaultCellStyle { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

The System.Windows.Forms.DataGridView control displays its cells using the styles indicated by the cell DataGridViewCell.InheritedStyle property, which inherits styles from other properties of type System.Windows.Forms.DataGridViewCellStyle. The styles specified through the DataGridView.DefaultCellStyle property affect all cells except when overridden by the styles specified through the following properties:

For more information, see Cell Styles in the Windows Forms DataGridView Control.

When getting this property, a System.Windows.Forms.DataGridViewCellStyle with default values will be created if the property has not already been accessed. This can cause a performance impact when getting this property for many rows. Whenever possible, use a single System.Windows.Forms.DataGridViewCellStyle to set this property for multiple rows. For more information, see Best Practices for Scaling the Windows Forms DataGridView Control.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0