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

定義

傳回圍住儲存格之內容區域的周框 (Bounding Rectangle)。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.Empty會傳回。The 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.Empty會傳回。The base class implementation always returns Rectangle.Empty.

當讀取ContentBounds屬性時,會在內部呼叫這個方法。This method is called internally when the ContentBounds property is read.

另請參閱

適用於