Can you change the format of the date on the date scaler?
We would like to change for example, “0502-08” to “May 02-08”, when at one week resolution.
In GTP.NET you can set DateScaler.CultureInfoDateTimeFormat to change the date format to another cultural style to get the same effect in phGantTimePackage you must change the locales setting…
BUT you probably want to override the suggested output;
In GTP.NET Implement the event DateScaler.OnDateScalerDrawString and override the output by changing the argument e.OutputText.
private void dateScaler1_OnDateScalerDrawString(PlexityHide.GTP.DateScaler dateScaler, PlexityHide.GTP.DateScalerDrawStringEventArgs e)
// If you want to customize the way the date scaler draws its strings, you can…
if ((e.LongIntervall && e.Resolution==NonLinearTime.TimeResolution.days) && (!dateScaler1.UseDayNumbersNotWeeks))
// In this case we override the long intervall presentation when the resolution of the lower is Days ;
e.OutputText=e.DateTime.ToString(“MMdd”)+” – “+e.DateTime.AddDays(6).ToString(“MMdd”);
Additional information from our friend Uli: I would like to change the DateScaler string. FAQ Q10070 describes a solution but there is a problem with the displayed DateTime which doesn´t agree to the displayed days. There is a small offset of three days. I did the following:
void DateScaler_OnDateScalerDrawString(DateScaler dateScaler, DateScalerDrawStringEventArgs e)
e.OutputText=e.DateTime.ToString(“dd.MM”)+” – “+e.DateTime.AddDays(6).ToString(“dd.MM”);
Supports answer: The answer to this is that weeks presentation is performed when drawMarker.DayOfWeek == timeLine.MidWeek, so Uli is correct. For week presentation the supplied date will need an AddDays(-3) for displaying the start of the week correctly. This was a bit unexpected in the design phase but we are keeping this behaviour so you can safely substract 3 days to get the start and add 3 days to get the end of the week (all cultures have 7 days a week right?!).
In phGantTimePackage you implement the event OnScalerStringShort and OnScalerStringLong to change the short and long intervall representation.
Also; the Gantt.DateScaler.ShowWeekNumbers=true and the Gantt.DateScaler.StartOfWeek property is an easy way to an alternative week presentation.