DataGridViewRow.PaintCells 方法

定义

在当前行中绘制单元格。

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

参数

graphics
Graphics

用于绘制 DataGridViewRowGraphics

clipBounds
Rectangle

Rectangle,它表示需要绘制的 DataGridView 区域。

rowBounds
Rectangle

一个 Rectangle,包含正在绘制的 DataGridViewRow 的边界。

rowIndex
Int32

当前所绘制的单元格的行索引。

rowState
DataGridViewElementStates

用于指定行的状态的 DataGridViewElementStates 值的按位组合。

isFirstDisplayedRow
Boolean

若要指示当前行是 DataGridView 中显示的第一行,则为 true;否则为 false

isLastVisibleRow
Boolean

若要指示当前行是 DataGridView(已将 Visible 属性设置为 true)中的最后一行,则为 true;否则为 false

paintParts
DataGridViewPaintParts

用于指示要绘制的单元格部分的 DataGridViewPaintParts 值的按位组合。

例外

行尚未添加到 DataGridView 控件。

paintParts 不是 DataGridViewPaintParts 值的有效按位组合。

注解

控件 DataGridView 调用此方法来绘制行中的单元格,除非事件的处理程序 DataGridView.RowPrePaintHandledEventArgs.Handled 属性设置为 true。 有关详细信息,请参阅 Paint

适用于

另请参阅