GetSize Method

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
)
protected Size GetSize (
	int rowIndex
)
protected override function GetSize (
	rowIndex : int
) : Size
Not applicable.

Parameters

rowIndex

The row index of the header cell.

Return Value

A Size that represents the size of the header cell.

Exception typeCondition

ArgumentOutOfRangeException

The value of the DataGridView property for this cell is a null reference (Nothing in Visual Basic) and rowIndex does not equal -1.

-or-

The value of the OwningColumn property for this cell is not a null reference (Nothing in Visual Basic) and rowIndex does not equal -1.

-or-

The value of the OwningRow property for this cell is not a null reference (Nothing in Visual Basic) 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 a null reference (Nothing in Visual Basic) and rowIndex does not equal -1.

ArgumentException

The value of the OwningRow property for this cell is not a null reference (Nothing in Visual Basic) 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).

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2016 Microsoft