Export (0) Print
Expand All

DataGridViewRow.DrawFocus Method

Draws a focus rectangle around the specified bounds.

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

protected internal virtual void DrawFocus(
	Graphics graphics,
	Rectangle clipBounds,
	Rectangle bounds,
	int rowIndex,
	DataGridViewElementStates rowState,
	DataGridViewCellStyle cellStyle,
	bool cellsPaintSelectionBackground


Type: System.Drawing.Graphics
The Graphics used to paint the DataGridViewRow.
Type: System.Drawing.Rectangle
A Rectangle that represents the area of the DataGridView that needs to be painted.
Type: System.Drawing.Rectangle
A Rectangle that contains the bounds of the DataGridViewRow that is being painted.
Type: System.Int32
The row index of the cell that is being painted.
Type: System.Windows.Forms.DataGridViewElementStates
A bitwise combination of DataGridViewElementStates values that specifies the state of the row.
Type: System.Windows.Forms.DataGridViewCellStyle
The DataGridViewCellStyle used to paint the focus rectangle.
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.


The row has not been added to a DataGridView control.


graphics is null.


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

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

© 2015 Microsoft