DataGrid.GetCellBounds Method (DataGridCell)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets the Rectangle of the cell specified by DataGridCell.

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

public Rectangle GetCellBounds(
	DataGridCell dgc
)

Parameters

dgc
Type: System.Windows.Forms.DataGridCell

The DataGridCell to look up.

Return Value

Type: System.Drawing.Rectangle

A Rectangle that defines the current cell's corners.

The following code example uses the GetCellBounds method to return a Rectangle of a specified cell.

protected DataGridCell dgc;

protected void GetRect(){
    Rectangle rect;
    dgc.ColumnNumber = 0;
    dgc.RowNumber = 0;
    rect = dataGrid1.GetCellBounds(dgc);
    Console.WriteLine(rect.ToString());
 }

.NET Framework
Available since 1.1
Return to top
Show: