共用方式為


DataGridViewRow.DrawFocus 方法

定義

在指定的界限四周繪製焦點矩形 (Focus Rectangle)。

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)

參數

graphics
Graphics

用來繪製 DataGridViewRowGraphics

clipBounds
Rectangle

Rectangle,表示需要繪製的 DataGridView 區域。

bounds
Rectangle

Rectangle,包含要繪製 DataGridViewRow 的界限。

rowIndex
Int32

正在繪製的儲存格資料列索引。

rowState
DataGridViewElementStates

DataGridViewElementStates 值的位元組合,指定資料列的狀態。

cellStyle
DataGridViewCellStyle

繪製焦點矩形所用的 DataGridViewCellStyle

cellsPaintSelectionBackground
Boolean

true 表示要使用 cellStyleSelectionBackColor 屬性做為焦點矩形的色彩;false 則表示要使用 cellStyleBackColor 屬性做為焦點矩形的色彩。

例外狀況

資料列未加入至 DataGridView 控制項。

graphicsnull

-或- cellStylenull

備註

參數 rowIndex 不會用於 方法的 DrawFocus 基類實作中,不過在衍生類別中覆寫此方法時可以使用此參數。

適用於

另請參閱