Customizing the Windows Forms DataGridView Control
The DataGridView control provides several properties that you can use to adjust the appearance and basic behavior (look and feel) of its cells, rows, and columns. If you have special needs that go beyond the capabilities of the DataGridViewCellStyle class, however, you can also implement owner drawing for the control or extend its capabilities by creating custom cells, columns, and rows.
To paint cells and rows yourself, you can handle various DataGridView painting events. To modify existing functionality or provide new functionality, you can create your own types derived from the existing DataGridViewCell, DataGridViewColumn, and DataGridViewRow types. You can also provide new editing capabilities by creating derived types that display a control of your choosing when a cell is in edit mode.
In This Section
How to: Customize the Appearance of Cells in the Windows Forms DataGridView Control
Describes how to handle the CellPainting event in order to paint cells manually.How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control
Describes how to handle the RowPrePaint and RowPostPaint events in order to paint rows with a custom, gradient background and content that spans multiple columns.How to: Customize Cells and Columns in the Windows Forms DataGridView Control by Extending Their Behavior and Appearance
Describes how to create custom types derived from DataGridViewCell and DataGridViewColumn in order to highlight cells when the mouse pointer rests on them.How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control
Describes how to create custom types derived from DataGridViewButtonCell and DataGridViewButtonColumn in order to display disabled buttons in a button column.How to: Host Controls in Windows Forms DataGridView Cells
Describes how to implement the IDataGridViewEditingControl interface and create custom types derived from DataGridViewCell and DataGridViewColumn in order to display a DateTimePicker control when a cell is in edit mode.
Reference
DataGridView
Provides reference documentation for the DataGridView control.DataGridViewCell
Provides reference documentation for the DataGridViewCell class.DataGridViewRow
Provides reference documentation for the DataGridViewRow class.DataGridViewColumn
Provides reference documentation for the DataGridViewColumn class.IDataGridViewEditingControl
Provides reference documentation for the IDataGridViewEditingControl interface.
Related Sections
- Basic Formatting and Styling in the Windows Forms DataGridView Control
Provides topics that describe how to modify the basic appearance of the control and the display formatting of cell data.
See Also
Concepts
Column Types in the Windows Forms DataGridView Control