DataGridViewCell.GetContentBounds DataGridViewCell.GetContentBounds DataGridViewCell.GetContentBounds DataGridViewCell.GetContentBounds Method

定义

返回环绕单元格的内容区域的边框。Returns the bounding rectangle that encloses the cell's content area.

重载

GetContentBounds(Int32) GetContentBounds(Int32) GetContentBounds(Int32) GetContentBounds(Int32)

使用默认的 Graphics 和单元格当前应用的单元格样式,返回围绕单元格内容区域的边框。Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell.

GetContentBounds(Graphics, DataGridViewCellStyle, Int32) GetContentBounds(Graphics, DataGridViewCellStyle, Int32) GetContentBounds(Graphics, DataGridViewCellStyle, Int32)

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

GetContentBounds(Int32) GetContentBounds(Int32) GetContentBounds(Int32) GetContentBounds(Int32)

使用默认的 Graphics 和单元格当前应用的单元格样式,返回围绕单元格内容区域的边框。Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell.

public:
 System::Drawing::Rectangle GetContentBounds(int rowIndex);
public System.Drawing.Rectangle GetContentBounds (int rowIndex);
member this.GetContentBounds : int -> System.Drawing.Rectangle
Public Function GetContentBounds (rowIndex As Integer) As Rectangle

参数

rowIndex
Int32 Int32 Int32 Int32

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

返回

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

异常

指定的 rowIndex 小于 0,或大于控件中的行数减 1。The specified rowIndex is less than 0 or greater than the number of rows in the control minus 1.

ColumnIndex 小于 0,这表示该单元格为行标头单元格。ColumnIndex is less than 0, indicating that the cell is a row header cell.

注解

调用此方法时,动态计算的单元格的内容大小。The size of the cell's contents is computed dynamically when this method is called. 基类实现始终返回Rectangle.EmptyThe base class implementation always returns Rectangle.Empty.

另请参阅

GetContentBounds(Graphics, DataGridViewCellStyle, Int32) GetContentBounds(Graphics, DataGridViewCellStyle, Int32) GetContentBounds(Graphics, DataGridViewCellStyle, Int32)

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

protected:
 virtual System::Drawing::Rectangle GetContentBounds(System::Drawing::Graphics ^ graphics, System::Windows::Forms::DataGridViewCellStyle ^ cellStyle, int rowIndex);
protected virtual System.Drawing.Rectangle GetContentBounds (System.Drawing.Graphics graphics, System.Windows.Forms.DataGridViewCellStyle cellStyle, int rowIndex);
abstract member GetContentBounds : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int -> System.Drawing.Rectangle
override this.GetContentBounds : System.Drawing.Graphics * System.Windows.Forms.DataGridViewCellStyle * int -> System.Drawing.Rectangle

参数

graphics
Graphics Graphics Graphics Graphics

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

rowIndex
Int32 Int32 Int32 Int32

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

返回

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

注解

调用此方法时,动态计算的单元格的内容大小。The size of the cell's contents is computed dynamically when this method is called. 基类实现始终返回Rectangle.EmptyThe base class implementation always returns Rectangle.Empty.

当在内部调用此方法ContentBounds属性为只读。This method is called internally when the ContentBounds property is read.

另请参阅

适用于