DataGridViewRow.Paint Method (Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Boolean, Boolean)

 

Paints the current row.

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

protected internal virtual void Paint(
	Graphics graphics,
	Rectangle clipBounds,
	Rectangle rowBounds,
	int rowIndex,
	DataGridViewElementStates rowState,
	bool isFirstDisplayedRow,
	bool isLastVisibleRow
)

Parameters

graphics
Type: System.Drawing.Graphics

The Graphics used to paint the DataGridViewRow.

clipBounds
Type: System.Drawing.Rectangle

A Rectangle that represents the area of the DataGridView that needs to be painted.

rowBounds
Type: System.Drawing.Rectangle

A Rectangle that contains the bounds of the DataGridViewRow that is being painted.

rowIndex
Type: System.Int32

The row index of the cell that is being painted.

rowState
Type: System.Windows.Forms.DataGridViewElementStates

A bitwise combination of DataGridViewElementStates values that specifies the state of the row.

isFirstDisplayedRow
Type: System.Boolean

true to indicate whether the current row is the first row displayed in the DataGridView; otherwise, false.

isLastVisibleRow
Type: System.Boolean

true to indicate whether the current row is the last row in the DataGridView that has the Visible property set to true; otherwise, false.

Exception Condition
InvalidOperationException

The row has not been added to a DataGridView control.

-or-

The row is in a DataGridView control and is a shared row.

ArgumentOutOfRangeException

The row is in a DataGridView control and rowIndex is less than zero or greater than the number of rows in the control minus one.

The DataGridView control calls this method to paint the row.

Calling this method raises the DataGridView.RowPrePaint event. If a handler for the event does not set the HandledEventArgs.Handled property to true, this method also calls the PaintHeader and PaintCells methods and raises the DataGridView.RowPostPaint event.

.NET Framework
Available since 2.0
Return to top
Show: