Question
is it possible to change the backcolor of the Holyday (saturday and sunday) that automatically have a different color?
Answer
In GTP.NET you can solve this in a number of ways:
#1 Use the
VerticalDayStripes Vertical stripes on certain days
VerticalDayStripes_Days VerticalDayStripes set to true, this property then chooses the days, sat and sun default
#2 draw time dependent stuff in the background; as shown in this article: http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10066
#3 Override the text output in the datescaler like this:
private void dateScaler1_OnDateScalerDrawString(PlexityHide.GTP.DateScaler dateScaler, PlexityHide.GTP.DateScalerDrawStringEventArgs e)
{
if (checkBoxRedSun.Checked)
{
// If you want to customize the way the date scaler draws its strings, you can...
if (e.DateTime.DayOfWeek==DayOfWeek.Sunday )
{
if ((!e.LongIntervall && e.Resolution==NonLinearTime.TimeResolution.days) ||
(e.LongIntervall && (e.Resolution==NonLinearTime.TimeResolution.hours6 || e.Resolution==NonLinearTime.TimeResolution.hours3 || e.Resolution==NonLinearTime.TimeResolution.hours)))
{
e.Brush=new SolidBrush(Color.Red);
e.Font=new Font("Arial", 10,FontStyle.Bold);
// In this case we only change the font and let the standard drawing continue, but you can just as easily completly override the default string. Just return e.ContinueDraw=FALSE;
e.ContinueDraw=true;
}
}
}
if (checkBoxMyOwnWeekPres.Checked)
{
// 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");
e.ContinueDraw=true;
}
}
}