Occurs before a DataGridViewRow is painted
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
You can handle this event alone or in combination with the RowPostPaint event to customize the appearance of rows in the control. You can paint entire rows yourself, or paint specific parts of rows and use the following methods of the DataGridViewRowPrePaintEventArgs class to paint other parts:
You can also use the VisualStyleRenderer class to paint standard controls using the current theme. For more information, see Rendering Controls with Visual Styles. If you are using Visual Studio 2005, you also have access to a large library of standard images that you can use with the DataGridView control.
For more information about handling events, see Consuming Events.
The following code example demonstrates how to use a handler for the event to paint a gradient row background if the row is selected. This example is part of a larger example available in How to: Customize the Appearance of Rows in the Windows Forms DataGridView Control.