10593 : How do I obtain the (Grid) Node that was double-clicked?

Question

How do I obtain the (Grid) Node that was double-clicked?

I’ve tried a few things including:

 void GanttView_OnGridDoubleClick(object sender, EventArgs e)
    {
      Point p = PointToClient(MousePosition);
      Cell c = this.Grid.GridStructure.CellFromXY(p.X,p.Y);
      if (c != null)
      {
      }
  
    }

The cell returned is always null, I have a double-click handler on the timeitemarea and I’m able to locate the correct TimeItem no problem..

Answer

Your code is correct but the PointToClient translates to Gantt-coords and not grid coords. change to this:

      Point p = this.Grid.PointToClient(MousePosition);

Leave a Reply