Question
Is it possible (with version 1.1 or 2.0 or both) to have a progress in my timeitem, lets say x percent are blue, and 100-x percent are red or something like this?
I have a timeitem, it last 20 hours, and 15 hours are already finished, so can I see that progress somehow?
Answer
One way to visualize progress in a time items is to make the time item TimeItemStyle.User and implement the user draw, in this sample I have put the percent value in the UserReference property of the time item. I calculate the size of the progress bar as a function of the rectangle width.
Note that I choose to re-use the standard drawing of a TimeItemStyle.Square time item
private void gantt1_OnTimeItem_UserDraw(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
{
e.TimeItem.TimeItemLayout.TimeItemStyle=TimeItemStyle.Square;
TimeItemDraw.Draw(e.G,e.TimeItem,e.Rect,e.TimeItem.Selected,e.TimeItem.TimeItemLayout);
e.TimeItem.TimeItemLayout.TimeItemStyle=TimeItemStyle.User;
if (e.TimeItem.UserReference is Double)
{
System.Drawing.Point xy1=new System.Drawing.Point(e.Rect.Left,(int)(e.Rect.Top+e.Rect.Height/2));
System.Drawing.Point xy2=new System.Drawing.Point(xy1.X+(int)(((double)e.TimeItem.UserReference)/100*e.Rect.Width),xy1.Y);
e.G.DrawLine(new Pen(Color.YellowGreen,3),xy1,xy2);
}
}