Skip to main content

SpreadsheetControl.GetCellFromPoint(PointF) Method

Gets a worksheet cell located at the specified point.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v23.2.dll

NuGet Package: DevExpress.Wpf.Spreadsheet

Declaration

public Cell GetCellFromPoint(
    PointF clientPoint
)

Parameters

Name Type Description
clientPoint PointF

A PointF structure specifying the location for which the position is retrieved. The point coordinates are measured in documents units.

Returns

Type Description
Cell

A Cell object.

Remarks

The code sample below obtain a cell by the clicked point:

using DevExpress.Xpf.Core;
using System.Windows.Input;
using DevExpress.Spreadsheet;
using System.Drawing;

private void spreadsheet_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
    System.Windows.Point p = e.GetPosition(spreadsheet);
    Cell cell = spreadsheet.GetCellFromPoint(new System.Drawing.PointF((float)p.X, (float)p.Y));
    if(cell != null)
    {
      //your code here
    }
} 
See Also