Editar

Compartir a través de


DataGridViewHeaderCell.GetSize(Int32) Method

Definition

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

Parameters

rowIndex
Int32

The row index of the header cell.

Returns

A Size that represents the size of the header cell.

Exceptions

The value of the DataGridView property for this cell is null and rowIndex does not equal -1.

-or-

The value of the OwningColumn property for this cell is not null and rowIndex does not equal -1.

-or-

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-

The values of the OwningColumn and OwningRow properties of this cell are both null and rowIndex does not equal -1.

The value of the OwningRow property for this cell is not null and rowIndex indicates a row other than the OwningRow.

Remarks

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.

If the cell is not attached to a DataGridView, the Size property of the DataGridViewHeaderCell returns the value (-1,-1).

Applies to

See also