DataGridViewHeaderCell.GetSize(Int32) DataGridViewHeaderCell.GetSize(Int32) DataGridViewHeaderCell.GetSize(Int32) DataGridViewHeaderCell.GetSize(Int32) Method

定義

取得儲存格的大小。Gets the size of the cell.

protected:
 override System::Drawing::Size GetSize(int rowIndex);
protected override System.Drawing.Size GetSize (int rowIndex);
override this.GetSize : int -> System.Drawing.Size
Protected Overrides Function GetSize (rowIndex As Integer) As Size

參數

rowIndex
Int32 Int32 Int32 Int32

標題儲存格的資料列索引。The row index of the header cell.

傳回

Size,表示標題儲存格的大小。A Size that represents the size of the header cell.

例外狀況

此儲存格的 DataGridView 屬性值為 null,且 rowIndex 不等於 -1。The value of the DataGridView property for this cell is null and rowIndex does not equal -1.

-或--or- 此儲存格的 OwningColumn 屬性值不為 null,且 rowIndex 不等於 -1。The value of the OwningColumn property for this cell is not null and rowIndex does not equal -1.

-或--or- 此儲存格的 OwningRow 屬性值不是 null,而且 rowIndex 小於零或是大於或等於控制項中的資料列數。The value of the OwningRow property for this cell is not null and rowIndex is less than zero or greater than or equal to the number of rows in the control.

-或--or- 此儲存格的 OwningColumnOwningRow 屬性值皆為 null,且 rowIndex 不等於 -1。The values of the OwningColumn and OwningRow properties of this cell are both null and rowIndex does not equal -1.

此儲存格的 OwningRow 屬性值不為 null,且 rowIndex 表示非 OwningRow 的資料列。The value of the OwningRow property for this cell is not null and rowIndex indicates a row other than the OwningRow.

備註

如果標頭儲存格是資料行標頭, 則此DataGridViewTopLeftHeaderCell 方法會傳回必要的大小,如果標題列是資料列行首,則必須符合資料列標頭的資料行大小,或如果儲存格為,則為所需的大小。GetSize左上方的標題儲存格。The GetSize method returns the size necessary to fit in a row of column headers if the header cell is a column header, the size necessary to fit in a column of row headers if the header cell is a row header, or the size necessary to be a DataGridViewTopLeftHeaderCell if the cell is a top left header cell.

如果資料格未附加至DataGridView Size , 則的屬性DataGridViewHeaderCell會傳回值 (-1,-1)。If the cell is not attached to a DataGridView, the Size property of the DataGridViewHeaderCell returns the value (-1,-1).

適用於

另請參閱