public override void OnDrawDay(CalendarRendererDayEventArgs e)
        {
            Rectangle r         = e.Day.Bounds;
            Color     backColor = ColorTable.DayBackgroundEven;
            bool      draw      = true;

            if (e.Day.Selected)
            {
                backColor = ColorTable.DayBackgroundSelected;
            }
            else if (e.Day.Date.Month % 2 == 0)
            {
                backColor = ColorTable.DayBackgroundEven;
            }
            else
            {
                backColor = ColorTable.DayBackgroundOdd;
            }

            if (e.Calendar.DaysMode == CalendarDaysMode.Short && e.Calendar.Holidays.ContainsKey(e.Day.Date))
            {
                //Get the image and if it exists, draw it.
                Image i = e.Calendar.Holidays.GetImageForDay(e.Day.Date);
                if (i != null)
                {
                    var imgRect = new Rectangle(r.X, r.Y + e.Day.HeaderBounds.Height, r.Width, r.Height - e.Day.HeaderBounds.Height);
                    if (imgRect.Height > 0 && imgRect.Width > 0)
                    {
                        e.Graphics.DrawImage(i, imgRect);
                    }

                    if (e.Day.Selected)
                    {
                        backColor = CalendarColorTable.FromBaseColor(backColor, 110);
                    }
                    else
                    {
                        draw = false;
                    }
                }
            }

            if (draw)
            {
                using (Brush b = new SolidBrush(backColor))
                    if (r.Width > 0 && r.Height > 0)
                    {
                        e.Graphics.FillRectangle(b, r);
                    }
            }

            base.OnDrawDay(e);
        }
Exemple #2
0
        public CalendarProfessionalRenderer(Calendar c)
            : base(c)
        {
            ColorTable.Background               = FromHex("#E3EFFF");
            ColorTable.DayBackgroundEven        = FromHex("#A5BFE1");
            ColorTable.DayBackgroundOdd         = FromHex("#FFFFFF");
            ColorTable.DayBackgroundSelected    = FromHex("#E6EDF7");
            ColorTable.DayBorder                = FromHex("#5D8CC9");
            ColorTable.DayHeaderBackground      = FromHex("#DFE8F5");
            ColorTable.DayHeaderText            = FromHex("#465B6E"); //Color.Black;
            ColorTable.DayHeaderSecondaryText   = FromHex("#465B6E"); //Color.Black;
            ColorTable.DayTopBorder             = FromHex("#5D8CC9");
            ColorTable.DayTopSelectedBorder     = FromHex("#5D8CC9");
            ColorTable.DayTopBackground         = FromHex("#A5BFE1");
            ColorTable.DayTopSelectedBackground = FromHex("#294C7A");
            ColorTable.ItemBorder               = FromHex("#5D8CC9");
            ColorTable.ItemBackground           = FromHex("#C0D3EA");
            ColorTable.ItemText                        = FromHex("#465B6E");
            ColorTable.ItemSecondaryText               = FromHex("#294C7A");
            ColorTable.ItemSelectedBorder              = FromHex("#4476BF"); //Color.Black;
            ColorTable.ItemSelectedBackground          = FromHex("#C0D3EA");
            ColorTable.ItemSelectedText                = FromHex("#465B6E"); //Color.Black;
            ColorTable.WeekHeaderBackground            = FromHex("#DFE8F5");
            ColorTable.WeekHeaderBorder                = FromHex("#5D8CC9");
            ColorTable.WeekHeaderText                  = FromHex("#5D8CC9");
            ColorTable.TodayBorder                     = FromHex("#EE9311");
            ColorTable.TodayTopBackground              = FromHex("#EE9311");
            ColorTable.TimeScaleLine                   = FromHex("#6593CF");
            ColorTable.TimeScaleHours                  = FromHex("#6593CF");
            ColorTable.TimeScaleMinutes                = FromHex("#6593CF");
            ColorTable.TimeUnitBackground              = FromHex("#E6EDF7");
            ColorTable.TimeUnitHighlightedBackground   = Color.White;
            ColorTable.TimeUnitSelectedBackground      = FromHex("#294C7A");
            ColorTable.TimeUnitBorderLight             = FromHex("#D5E1F1");
            ColorTable.TimeUnitBorderDark              = FromHex("#A5BFE1");
            ColorTable.TimeUnitNotAvailable            = FromHex("#E6EDF7");
            ColorTable.TimeUnitNotAvailableHighlighted = FromHex("#E6EDF7");
            ColorTable.TimeUnitNotAvailableSelected    = CalendarColorTable.Combine(ColorTable.TimeUnitNotAvailable, ColorTable.TimeUnitSelectedBackground);
            ColorTable.WeekDayName                     = FromHex("#6593CF");

            SelectedItemBorder = 2f;
            ItemRoundness      = 5;
        }
Exemple #3
0
 /// <summary>
 /// Shortcut to one on CalendarColorTable
 /// </summary>
 /// <param name="color"></param>
 /// <returns></returns>
 private static Color FromHex(string color)
 {
     return(CalendarColorTable.FromHex(color));
 }
 public CalendarSystemRenderer(Calendar calendar)
     : base(calendar)
 {
     ColorTable         = new CalendarColorTable();
     SelectedItemBorder = 1;
 }