DataGrid::GetCurrentCellBounds Method ()

 

Gets a Rectangle that specifies the four corners of the selected cell.

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

public:
Rectangle GetCurrentCellBounds()

Return Value

Type: System.Drawing::Rectangle

A Rectangle that defines the current cell's corners.

To retrieve the cell bounds for a cell other than the current cell, use GetCellBounds.

The following code example gets the Rectangle of the selected cell.

private:
   void dataGrid1_CurrentCellChange( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      Rectangle rect;
      rect = dataGrid1->GetCurrentCellBounds();
      Console::WriteLine( rect );
   }

.NET Framework
Available since 1.1
Return to top
Show: