DataGridView.GetCellDisplayRectangle(Int32, Int32, Boolean) Method

Definition

Returns the rectangle that represents the display area for a cell.

C#
public System.Drawing.Rectangle GetCellDisplayRectangle(int columnIndex, int rowIndex, bool cutOverflow);

Parameters

columnIndex
Int32

The column index for the desired cell.

rowIndex
Int32

The row index for the desired cell.

cutOverflow
Boolean

true to return the displayed portion of the cell only; false to return the entire cell bounds.

Returns

The Rectangle that represents the display rectangle of the cell.

Exceptions

columnIndex is less than -1 or greater than the number of columns in the control minus 1.

-or-

rowIndex is less than -1 or greater than the number of rows in the control minus 1.

Remarks

This method returns the entire cell bounds or the displayed portion only. To get the bounds of the cell contents only, use the cell ContentBounds property.

Applies to

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also