Bewerken

Delen via


DataGridViewRow.DrawFocus Method

Definition

Draws a focus rectangle around the specified bounds.

protected public:
 virtual void DrawFocus(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle clipBounds, System::Drawing::Rectangle bounds, int rowIndex, System::Windows::Forms::DataGridViewElementStates rowState, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, bool cellsPaintSelectionBackground);
protected internal virtual void DrawFocus (System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle bounds, int rowIndex, System.Windows.Forms.DataGridViewElementStates rowState, System.Windows.Forms.DataGridViewCellStyle cellStyle, bool cellsPaintSelectionBackground);
abstract member DrawFocus : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Rectangle * int * System.Windows.Forms.DataGridViewElementStates * System.Windows.Forms.DataGridViewCellStyle * bool -> unit
override this.DrawFocus : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Rectangle * int * System.Windows.Forms.DataGridViewElementStates * System.Windows.Forms.DataGridViewCellStyle * bool -> unit
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
Graphics

The Graphics used to paint the DataGridViewRow.

clipBounds
Rectangle

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

bounds
Rectangle

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

rowIndex
Int32

The row index of the cell that is being painted.

rowState
DataGridViewElementStates

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

cellStyle
DataGridViewCellStyle

The DataGridViewCellStyle used to paint the focus rectangle.

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

Exceptions

The row has not been added to a DataGridView control.

graphics is null.

-or-

cellStyle is null.

Remarks

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.

Applies to

See also