DataGridViewRow.Paint 方法

定義

繪製目前的資料列。

protected public:
 virtual void Paint(System::Drawing::Graphics ^ graphics, System::Drawing::Rectangle clipBounds, System::Drawing::Rectangle rowBounds, int rowIndex, System::Windows::Forms::DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow);
protected internal virtual void Paint (System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle rowBounds, int rowIndex, System.Windows.Forms.DataGridViewElementStates rowState, bool isFirstDisplayedRow, bool isLastVisibleRow);
abstract member Paint : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Rectangle * int * System.Windows.Forms.DataGridViewElementStates * bool * bool -> unit
override this.Paint : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Rectangle * int * System.Windows.Forms.DataGridViewElementStates * bool * bool -> unit
Protected Friend Overridable Sub Paint (graphics As Graphics, clipBounds As Rectangle, rowBounds As Rectangle, rowIndex As Integer, rowState As DataGridViewElementStates, isFirstDisplayedRow As Boolean, isLastVisibleRow As Boolean)

參數

graphics
Graphics

用來繪製 DataGridViewRowGraphics

clipBounds
Rectangle

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

rowBounds
Rectangle

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

rowIndex
Int32

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

rowState
DataGridViewElementStates

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

isFirstDisplayedRow
Boolean

若要指出目前資料列是否為 DataGridView 中所顯示的第一個資料列,則為 true,否則為 false

isLastVisibleRow
Boolean

true 表示目前的資料列是否為將 DataGridView 屬性設為 trueVisible 中的最後一個資料列,否則為 false

例外狀況

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

-或-

資料列位於 DataGridView 控制項中而且是一個共用資料列。

這個資料列是在 DataGridView 控制項中,而且 rowIndex 小於零或大於控制項中的資料列數減一。

備註

控制項 DataGridView 會呼叫這個方法來繪製資料列。

呼叫這個方法會 DataGridView.RowPrePaint 引發 事件。 如果 事件的處理常式未將 HandledEventArgs.Handled 屬性設定為 true ,這個方法也會呼叫 PaintHeaderPaintCells 方法並引發 DataGridView.RowPostPaint 事件。

適用於

另請參閱