Export (0) Print
Expand All

DataGridViewHeaderCell.GetSize Method

Gets the size of the cell.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

protected override Size GetSize(
	int rowIndex
)

Parameters

rowIndex
Type: System.Int32

The row index of the header cell.

Return Value

Type: System.Drawing.Size
A Size that represents the size of the header cell.

ExceptionCondition
ArgumentOutOfRangeException

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.

ArgumentException

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

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).

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft