DataGridViewRow.DrawFocus Method (Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, DataGridViewCellStyle, Boolean)

 

Draws a focus rectangle around the specified bounds.

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

Protected Friend Overridable Sub DrawFocus (
	graphics As Graphics,
	clipBounds As Rectangle,
	bounds As Rectangle,
	rowIndex As Integer,
	rowState As DataGridViewElementStates,
	cellStyle As DataGridViewCellStyle,
	cellsPaintSelectionBackground As Boolean
)

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.

bounds
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.

cellStyle
Type: System.Windows.Forms.DataGridViewCellStyle

The DataGridViewCellStyle used to paint the focus rectangle.

cellsPaintSelectionBackground
Type: System.Boolean

true to use the SelectionBackColor property of cellStyle as the color of the focus rectangle; false to use the BackColor property of cellStyle as the color of the focus rectangle.

Exception Condition
InvalidOperationException

The row has not been added to a DataGridView control.

ArgumentNullException

graphics is null.

-or-

cellStyle is null.

The rowIndex parameter is not used in the base-class implementation of the DrawFocus method, although it can be used when overriding this method in a derived class.

.NET Framework
Available since 2.0
Return to top
Show: