DataGridViewRow.PaintHeader Method (Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Boolean, Boolean, DataGridViewPaintParts)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Paints the header cell of the current row.

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

abstract PaintHeader : 
        graphics:Graphics *
        clipBounds:Rectangle *
        rowBounds:Rectangle *
        rowIndex:int *
        rowState:DataGridViewElementStates *
        isFirstDisplayedRow:bool *
        isLastVisibleRow:bool *
        paintParts:DataGridViewPaintParts -> unit
override PaintHeader : 
        graphics:Graphics *
        clipBounds:Rectangle *
        rowBounds:Rectangle *
        rowIndex:int *
        rowState:DataGridViewElementStates *
        isFirstDisplayedRow:bool *
        isLastVisibleRow:bool *
        paintParts:DataGridViewPaintParts -> unit

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 that the current row is the first row displayed in the DataGridView; otherwise, false.

isLastVisibleRow
Type: System.Boolean

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

paintParts
Type: System.Windows.Forms.DataGridViewPaintParts

A bitwise combination of DataGridViewPaintParts values indicating the parts of the cells to paint.

Exception Condition
InvalidOperationException

The row has not been added to a DataGridView control.

InvalidEnumArgumentException

paintParts in not a valid bitwise combination of DataGridViewPaintParts values.

The DataGridView control calls this method to paint the row header except when a handler for the DataGridView.RowPrePaint event sets the HandledEventArgs.Handled property to true. For more information, see Paint.

.NET Framework
Available since 2.0
Return to top
Show: