IDataGrid.GetCellCoordAt

Syntax

GetCellCoordAt(Pt: IPoint): IPoint;

Parameters

Pt. Coordinates of the point, in which a component cell must be obtained.

Description

The GetCellCoordAt method transforms coordinates of the specified point into component cell coordinates.

Comments

The X coordinate in the received point will correspond to the column index, the Y will correspond to the row index. Depending on which component area the point corresponds, the following options are available:

Example

Executing the example requires a form and the DataGrid component named DataGrid1 on the form.

Sub DataGrid1OnMouseMove(Sender: Object; Args: IMouseEventArgs);
Var
    cell: IPoint;
Begin
    cell := DataGrid1.GetCellCoordAt(Args.pPoint);
    If (cell.X <> -1And (cell.Y <> -1Then
        Debug.WriteLine(cell.X.ToString + " " + cell.Y.ToString);
    End If;
End Sub DataGrid1OnMouseMove;

If the mouse cursor is hovered over the DataGrid1 component, the development environment console displays coordinates of the hovered cell.

See also:

IDataGrid