Katalogerna
PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


phGantTimePackage FAQ 10886


I would like to color columns for certain days in a different color with the phGantTimePackage. Please note that this article refers to the phGantTimePackage
Jump to article- 2007-04-28 16:58:00 - Email plexityHide

Question

Hi, I'd like to color columns for certain days in a different color with the phGantTimePackage. Could you pleace provide an example on how to achieve this with the OnGantAreaDrawBackground handler?

Thanks!

Answer

In order to do this you must know when a day starts and stops in pixels, this is easily found by sending in a datetime to the IphGantX3.DateToPixel method.

So in pseudo code I would go like this:

int numberOfDaysOnScreen=Round(phGant.Stop-phGant.Start)
for i=0 to numberOfDaysOnScreen-1 do
begin
  DateTime oneDay=phGantt.Start+i
  Color c=GetColorForThisDay(oneDay)
  int PixelForStartOfDay=phGantt.DateToPixel(Trunc(oneDay))
  int PixelForEndOfDay=phGantt.DateToPixel(Trunc(oneDay)+1)
  DrawColoredRectangle(PixelForStartOfDay,0,PixelForEndOfDay,Gantt.Height)
end

 

Google
WWW plexityHide phGantTimePackage FAQ
Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

Testimonials

"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%"
Gaurav Patole,
WebTechDevelopers
More testimonials...