10366 : Color of todayline

Question

Is there a possibility to make the today line appear in a different colour. A gantt chart is nothing if you dont see where today is directly. Please help me out I want to give a presentation whith our product and this functionality is very imortant. TIA

Answer

Currently a property to control the color of the today line is not exposed, partly because it is so very easy to draw your own things in the gantt background just by implementing the OnTimeItemAreaPaintBackground event…

New 0611: New property on the Gantt.TodayLineColor…. Download latest patch.

This is how the current today line is implemented (Add this code like this in the OnTimeItemAreaPaintBackground and elaborate):


      if (TodayLine)
      {
        if (DateScaler.StartTime<DateTime.Now && DateScaler.StopTime>DateTime.Now)
        {
          HatchBrush hatchBrush=new HatchBrush(HatchStyle.Percent50,Color.Black,TimeItemArea.BackColor);
          Pen pen=new Pen(hatchBrush,1);
          int x=DateScaler.TimeToPixel(DateTime.Now);
          if (TimeItemArea.FlipView)
            G.DrawLine(pen,TimeItemArea.CalcLeft,x,TimeItemArea.CalcWidth,x);
          else
            G.DrawLine(pen,x,TimeItemArea.CalcTop,x,TimeItemArea.CalcBottom);
        }
      
      
      }

Leave a Reply