10122 : tooltips on grid rows

Question

I was able to show task notes icon, as appears in MS Project, by creating custom cell. But I was unable to show desired notes as tooltip, is there anyway to show tooltip on a custom cell image, specific to different rows?

Answer

You can put a string in the GridNode.UserReference and then pick it up in the mouse move event:

    private void gantt1_OnGridMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    {

      Cell cell=gantt1.Grid.GridStructure.CellFromXY(e.X,e.Y);

      string tooltiptext=””;

      if (cell!=null)

      {

        if (cell.Node.UserReference is string)

        {

          tooltiptext=cell.Node.UserReference as string;

        }

      }

      toolTip1.SetToolTip(gantt1.Grid,tooltiptext);

    }

 

Leave a Reply