Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DataGridViewCellStyle Class

Represents the formatting and style information applied to individual cells within a DataGridView control.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public class DataGridViewCellStyle implements ICloneable

The DataGridViewCellStyle 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 DataGridViewCellStyle 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 DataGridViewCellStyle 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.

No code example is currently available or this language may not be supported.

System.Object
  System.Windows.Forms.DataGridViewCellStyle

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft