DataGridViewRowPrePaintEventArgs.PaintCellsBackground 方法

定義

繪製所指定界限內區域的儲存格背景。

public:
 void PaintCellsBackground(System::Drawing::Rectangle clipBounds, bool cellsPaintSelectionBackground);
public void PaintCellsBackground (System.Drawing.Rectangle clipBounds, bool cellsPaintSelectionBackground);
member this.PaintCellsBackground : System.Drawing.Rectangle * bool -> unit
Public Sub PaintCellsBackground (clipBounds As Rectangle, cellsPaintSelectionBackground As Boolean)

參數

clipBounds
Rectangle

Rectangle,指定要繪製的 DataGridView 區域。

cellsPaintSelectionBackground
Boolean

true 表示以 SelectionBackColorInheritedStyle 屬性的色彩繪製所指定界限的背景;false 則表示要以 BackColorInheritedStyle 屬性的色彩繪製所指定界限的背景。

例外狀況

RowIndex 小於零或大於 DataGridView 控制項的資料列數減一。

備註

當您自行繪製 DataGridViewRow 及其儲存格的內容時, PaintCellsBackground 請使用 方法。 如果您手動繪製整個資料列及其儲存格的內容,請將 HandledEventArgs.Handled 屬性設定為 true 。 當 為 trueHandledEventArgs.HandledCellPainting 不會發生 和 RowPostPaint 事件。

適用於

另請參閱