10041 : Context menu per time item

Question
I am developing an application that use your component GTP.NET under VisualStudio 2003
I cannot attach a ContextMenu in a specific TimeItem. It is possible how can I do it?
 

 
Answer
 
In the mousedown you can decide if the click is over a specific time item and then bring up your context menu;
 
I have this c# sample but it would be almost the same in VB, the important call is gantt1.TimeItemFromPoint(e.X,e.Y)
 
    private void gantt1_OnTimeItemAreaMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
    {
      if (e.Button==MouseButtons.Right)
      {
        if (gantt1.TimeItemFromPoint(e.X,e.Y)!=null)
        {
          GanttRow gr=gantt1.GanttRowFromY(e.Y);
          if (gr!=null)
          {
            menuItem1.Text=gr.GridNode.GetCell(0).Content.Value.ToString();           
            contextMenu1.Show(gantt1.TimeItemArea,new Point(e.X,e.Y));
          }
        }
      }
    }

Leave a Reply