![]() |
|
phGantTimePackage FAQ 10066I need is to be able to display various periods of calendar with several shifts (time periods) in a day.. Please note that this article
refers to the phGantTimePackage Jump to article- 2007-09-01 10:41:00 - Email plexityHide Question Hi, i am currently evaluating phGantTime package and i would like to see is it possible to a rosters with it. What i need is to be able to display various periods of calendar with several shifts (time periods) in a day..And i need to assign employees to shifts. Also i need to be able to draw holidays and weekends with different colors. Can you please send me some sample code? Because there are alot of properties, and so far i cant find a way how to customize this top line which displays date
Answer The sample code below draws a green background on Wednesdays and a red background on sunday. This sample is for GTP.NET but you can do the same thing in phGantTimePackage... private void gantt1_OnDateScalerPaintBackground(PlexityHide.GTP.OffscreenDraw aOffscreenDraw, PlexityHide.GTP.OffscreenDrawArgs e) { DoBack(e.G,gantt1.DateScaler.Height); } private void gantt1_OnTimeItemAreaPaintBackground(PlexityHide.GTP.OffscreenDraw aOffscreenDraw, PlexityHide.GTP.OffscreenDrawArgs e) { DoBack(e.G,gantt1.TimeItemArea.Height); } private void DoBack(Graphics G,int aHeight) { DateTime i=gantt1.DateScaler.StartTime; DateTime ii; Brush b_sunday=new SolidBrush(Color.Red); Brush b_wednesday=new SolidBrush(Color.Green); while (i<gantt1.DateScaler.StopTime) { ii=i.AddDays(1); int x1=gantt1.DateScaler.TimeToPixel(i.Subtract(i.TimeOfDay)); int x2=gantt1.DateScaler.TimeToPixel(ii.Subtract(ii.TimeOfDay)); if (i.DayOfWeek==DayOfWeek.Sunday ) G.FillRectangle(b_sunday,x1,0,x2-x1,aHeight); else if (i.DayOfWeek==DayOfWeek.Wednesday) G.FillRectangle(b_wednesday,x1,0,x2-x1,aHeight); i=ii; } }
|
"This is too GREAT. I must say you have strong support and really good programmers at your place. Your entire team is good. Just Fantastic! – 100%" |
| (C) 1999-2010 PlexityHide.com Grastensvagen 24, S-163 45 Spanga Sweden E-mail: support@plexityhide.com |