Basic Formatting and Styling in the Windows Forms DataGridView Control

The DataGridView control makes it easy to define the basic appearance of cells and the display formatting of cell values. You can define appearance and formatting styles for individual cells, for cells in specific columns and rows, or for all cells in the control by setting the properties of the DataGridViewCellStyle objects accessed through various DataGridView control properties. Additionally, you can modify these styles dynamically based on factors such as the cell value by handling the CellFormatting event.

In This Section

How to: Change the Border and Gridline Styles in the Windows Forms DataGridView Control
Describes how to set DataGridView properties that define the appearance of the control border and the boundary lines between cells.

Cell Styles in the Windows Forms DataGridView Control
Describes the DataGridViewCellStyle class and how properties of that type interact to define how cells are displayed in the control.

How to: Set Default Cell Styles for the Windows Forms DataGridView Control
Describes how to use DataGridViewCellStyle properties to define the default appearance of cells in specific rows and columns and in the entire control.

How to: Format Data in the Windows Forms DataGridView Control
Describes how to format cell display values using DataGridViewCellStyle properties.

How to: Set Font and Color Styles in the Windows Forms DataGridView Control
Describes how to use the DefaultCellStyle property to set basic display characteristics for all cells in the control.

How to: Set Alternating Row Styles for the Windows Forms DataGridView Control
Describes how to create a ledger-like effect in the control using alternating rows that are displayed differently.

How to: Use the Row Template to Customize Rows in the Windows Forms DataGridView Control
Describes how to use the RowTemplate property to set row properties that will be used for all rows in the control.

Reference

DataGridView
Provides reference documentation for the DataGridView control.

DataGridViewCellStyle
Provides reference documentation for the DataGridViewCellStyle class.

CellFormatting
Provides reference documentation for the CellFormatting event.

RowTemplate
Provides reference documentation for the RowTemplate property.

Customizing the Windows Forms DataGridView Control
Provides topics that describe custom painting DataGridView cells and rows, and creating derived cell, column, and row types.

Basic Column, Row, and Cell Features in the Windows Forms DataGridView Control
Provides topics that describe commonly used cell, row, and column properties.

See also