DataGridViewColumnHeaderCell.GetContentBounds(Graphics, DataGridViewCellStyle, Int32) 方法

定义

返回环绕单元格内容区域的边框,使用指定的 Graphics 对象和单元格样式计算此边框。Returns the bounding rectangle that encloses the cell's content area, which is calculated using the specified Graphics object and cell style.

protected:
 override System::Drawing::Rectangle GetContentBounds(System::Drawing::Graphics ^ graphics, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, int rowIndex);
protected override System.Drawing.Rectangle GetContentBounds (System.Drawing.Graphics graphics, System.Windows.Forms.DataGridViewCellStyle cellStyle, int rowIndex);
override this.GetContentBounds : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int -> System.Drawing.Rectangle
Protected Overrides Function GetContentBounds (graphics As Graphics, cellStyle As DataGridViewCellStyle, rowIndex As Integer) As Rectangle

参数

graphics
Graphics

单元格的图形上下文。The graphics context for the cell.

cellStyle
DataGridViewCellStyle

要应用到单元格的 DataGridViewCellStyleThe DataGridViewCellStyle to be applied to the cell.

rowIndex
Int32

该单元格的父行索引。The index of the cell's parent row.

返回

Rectangle

用于限定单元格内容的 RectangleThe Rectangle that bounds the cell's contents.

例外

rowIndex 不是 -1。rowIndex is not -1.

注解

调用此方法时,会动态计算单元格内容的大小。The size of the cell's contents is computed dynamically when this method is called. 当读取属性时,会在内部调用此方法 ContentBoundsThis method is called internally when the ContentBounds property is read.

适用于

另请参阅