DataGridViewCell.GetContentBounds 方法

定義

傳回圍住儲存格之內容區域的週框 (Bounding Rectangle)。

多載

GetContentBounds(Int32)

使用預設的 Graphics 和目前儲存格中所採用的儲存格樣式,傳回圍住儲存格內容區域的周框。

GetContentBounds(Graphics, DataGridViewCellStyle, Int32)

傳回圍住儲存格內容區域的週框,這個內容區域是使用指定的 Graphics 和儲存格樣式所計算。

GetContentBounds(Int32)

使用預設的 Graphics 和目前儲存格中所採用的儲存格樣式,傳回圍住儲存格內容區域的周框。

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

儲存格的父資料列索引。

傳回

圍繞儲存格內容的 Rectangle

例外狀況

指定的 rowIndex 小於 0 或大於控制項中資料列數減 1。

ColumnIndex 小於 0,表示儲存格是資料列行首儲存格。

備註

呼叫此方法時,會動態計算儲存格內容的大小。 基類實作一律會傳 Rectangle.Empty 回 。

另請參閱

適用於

GetContentBounds(Graphics, DataGridViewCellStyle, Int32)

傳回圍住儲存格內容區域的週框,這個內容區域是使用指定的 Graphics 和儲存格樣式所計算。

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
Protected Overridable Function GetContentBounds (graphics As Graphics, cellStyle As DataGridViewCellStyle, rowIndex As Integer) As Rectangle

參數

graphics
Graphics

儲存格的圖形內容。

cellStyle
DataGridViewCellStyle

要套用至儲存格的 DataGridViewCellStyle

rowIndex
Int32

儲存格的父資料列索引。

傳回

圍繞儲存格內容的 Rectangle

備註

呼叫此方法時,會動態計算儲存格內容的大小。 基類實作一律會傳 Rectangle.Empty 回 。

讀取 屬性時, ContentBounds 會在內部呼叫這個方法。

另請參閱

適用於