DataGridViewCell.GetContentBounds Method (Int32)

Note: This method is new in the .NET Framework version 2.0.

Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell.

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

public Rectangle GetContentBounds (
	int rowIndex
public Rectangle GetContentBounds (
	int rowIndex
public function GetContentBounds (
	rowIndex : int
) : Rectangle



The index of the cell's parent row.

Return Value

The Rectangle that bounds the cell's contents.

Exception typeCondition


The specified rowIndex is less than 0 or greater than the number of rows in the control minus 1.


ColumnIndex is less than 0, indicating that the cell is a row header cell.

The size of the cell's contents is computed dynamically when this method is called. The base class implementation always returns Rectangle.Empty.

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions