Position of selected cell

How do i find the position ( not the index of row and cloumn)of selected cell in a dataviewgrid I need it to place a control over the grid. Thanks.

Regards

Alu




Answer this question

Position of selected cell

  • an5w3r

    thanks alot! :)

    Regards

    Alu



  • Eric_Martin

    According to whether you want the display area or the client area you use one of the following:

    1. For the display area of the currently selected cell:
    Rectangle rec = grd.GetCellDisplayRectangle(grd.CurrentCell.ColumnIndex, grd.CurrentCell.RowIndex, false);

    the last argument, when true, returns only the displayed portion of the cell, when false, returns the whole cell.

    2. For content (client) area of the cell:
    Rectangle rec = grd.CurrentCell.ContentBounds;

    In boh cases, you have a rectangle with the position and size of the area you want!



  • Position of selected cell