DataGridViewCell.ContentBounds 属性

定义

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

public:
 property System::Drawing::Rectangle ContentBounds { System::Drawing::Rectangle get(); };
[System.ComponentModel.Browsable(false)]
public System.Drawing.Rectangle ContentBounds { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ContentBounds : System.Drawing.Rectangle
Public ReadOnly Property ContentBounds As Rectangle

属性值

Rectangle

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

属性

例外

包含该单元格的行是共享行。The row containing the cell is a shared row.

-或--or-

该单元格是列标题单元格。The cell is a column header cell.

ColumnIndex 属性的值小于 0,这表示该单元格为行标头单元格。The value of the ColumnIndex property is less than 0, indicating that the cell is a row header cell.

注解

返回的矩形报告客户端坐标(以像素为单位)。The returned rectangle reports client coordinates, in pixels.

此属性调用 GetContentBounds 方法来获取其值。This property calls the GetContentBounds method to get its value. 对于基 DataGridViewCell 类型,此值为 EmptyFor the base DataGridViewCell type, this value is Empty.

若要获取单元格的边框(而不是单元格内容),请使用 DataGridView.GetCellDisplayRectangle 方法。To get the bounding rectangle of the cell rather than the cell contents, use the DataGridView.GetCellDisplayRectangle method.

适用于

另请参阅