/// <summary>
 /// Draws a time unit of a day
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnDrawDayTimeUnit(CalendarRendererTimeUnitEventArgs e)
 {
 }
        public override void OnDrawDayTimeUnit(CalendarRendererTimeUnitEventArgs e)
        {
            base.OnDrawDayTimeUnit(e);

            using (SolidBrush b = new SolidBrush(ColorTable.TimeUnitBackground))
            {
                bool isAvail = false;
                if (e.Unit.Day != null && e.Unit.Day.Availability != null)
                {
                    foreach (var a in e.Unit.Day.Availability)
                    {
                        //if ((System.DateTime.Compare(e.Unit.Date, a.StartTime) + System.DateTime.Compare(e.Unit.Date, a.StartTime.Add(a.Duration))) == 0)
                        if (e.Unit.Date >= a.StartTime && e.Unit.Date < a.StartTime.Add(a.Duration))
                        {
                            isAvail = true;
                            break;
                        }
                        else
                        {
                            isAvail = false;
                        }
                    }
                }
                else
                {
                    isAvail = true;
                }


                if (e.Unit.Selected)
                {
                    if (isAvail)
                    {
                        b.Color = ColorTable.TimeUnitSelectedBackground;
                    }
                    else
                    {
                        b.Color = ColorTable.TimeUnitNotAvailableSelected;
                    }
                }
                else if (e.Unit.Highlighted)
                {
                    if (isAvail)
                    {
                        b.Color = ColorTable.TimeUnitHighlightedBackground;
                    }
                    else
                    {
                        b.Color = ColorTable.TimeUnitNotAvailableHighlighted;
                    }
                }
                else
                if (!isAvail)
                {
                    b.Color = Color.FromArgb(ColorTable.TimeUnitNotAvailable.R - 20, ColorTable.TimeUnitNotAvailable.G - 20, ColorTable.TimeUnitNotAvailable.B - 20);
                }
                else
                {
                    b.Color = ColorTable.TimeUnitHighlightedBackground;
                }

                e.Graphics.FillRectangle(b, e.Unit.Bounds);
            }

            using (Pen p = new Pen(e.Unit.Minutes == 0 ? ColorTable.TimeUnitBorderDark : ColorTable.TimeUnitBorderLight))
            {
                e.Graphics.DrawLine(p, e.Unit.Bounds.Location, new Point(e.Unit.Bounds.Right, e.Unit.Bounds.Top));
            }

            //TextRenderer.DrawText(e.Graphics, e.Unit.PassingItems.Count.ToString(), e.Calendar.Font, e.Unit.Bounds, Color.Black);
        }