10099 : How do I set the DateScaler properties to display the current date as starting date.

Question

How do I set the DateScaler properties to display the current date as starting date. I tried to set the StartTime and StopTime in the DateScaler properties box but the component is not refreshing, but it sets the StopTime to the date i specified, but the start time is always Aug 5 2003. Also I want the date should display in Hours…

Answer

It has come to our attention that setting the DateScaler.StartTime and DateScaler.StopTime only works if done in such a way that StartTime is always smaller than StopTime… This is considered a bug with low priority (exists in 1.3.1). The workaround is to use the DateScaler.TimeSpanSet(Start,Stop) that will work.

Going like this…

DateTime t = DateTime.Today;
t.AddDays(1);
gantt1.DateScaler.TimeSpanSet(DateTime.Today, t);

…will give you a view of one day. Depending on the width of the Gantt-area the scale will find a value that is the best presentation for one day. To get another resolution you add more days to the view.

 

Another similair question was: I want to center the view around a specific time item:

If you know where you want the middle of the visual span (xmiddle=timeItemStart+(timeItem.Duration()/2)) you can set the Datescaler to show this by calling Gantt.DateScaler.TimeSpanSet(xstart,xstop), 

where xstart=xmiddle-(timeItem.Duration()/2) and

xstop= xmiddle+(timeItem.Duration()/2)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Leave a Reply