public override void OnDrawDayHeaderText(CalendarRendererBoxEventArgs e)
 {
     if (_palette != null)
     {
         e.TextColor = _palette.GetContentShortTextColor1(PaletteContentStyle.HeaderForm, PaletteState.Normal);
     }
     base.OnDrawDayHeaderText(e);
 }
예제 #2
0
        public override void OnDrawItemEndTime(CalendarRendererBoxEventArgs e)
        {
            if (e.TextColor.IsEmpty)
            {
                e.TextColor = ColorTable.ItemSecondaryText;
            }

            base.OnDrawItemEndTime(e);
        }
        /// <summary>
        /// Paints the header of the specified day
        /// </summary>
        /// <param name="e">Paint info</param>
        /// <param name="atDate">Draw at date</param>
        public override void OnDrawDayHeaderText(CalendarRendererBoxEventArgs e, DateTime atDate)
        {
            if (atDate == DateTime.Now.Date)
            {
                e.TextColor = ColorTable.DayHeaderTodayText;
            }

            base.OnDrawDayHeaderText(e, atDate);
        }
예제 #4
0
        public override void OnDrawDayNameHeader(CalendarRendererBoxEventArgs e)
        {
            e.TextColor = ColorTable.WeekDayName;

            base.OnDrawDayNameHeader(e);

            using (var p = new Pen(ColorTable.WeekDayName))
            {
                e.Graphics.DrawLine(p, e.Bounds.Right, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom);
            }
        }
예제 #5
0
        public override void OnDrawItemText(CalendarRendererBoxEventArgs e)
        {
            var item = e.Tag as CalendarItem;

            if (item != null)
            {
                if (item.IsDragging)
                {
                    e.TextColor = Color.FromArgb(120, e.TextColor);
                }
            }

            base.OnDrawItemText(e);
        }
예제 #6
0
        public override void OnDrawWeekHeader(CalendarRendererBoxEventArgs e)
        {
            using (Brush b = new SolidBrush(ColorTable.WeekHeaderBackground))
            {
                e.Graphics.FillRectangle(b, e.Bounds);
            }

            using (var p = new Pen(ColorTable.WeekHeaderBorder))
            {
                e.Graphics.DrawRectangle(p, e.Bounds);
            }

            e.TextColor = ColorTable.WeekHeaderText;

            base.OnDrawWeekHeader(e);
        }
        /// <summary>
        /// Paints a name of the day column whenCalendar.DaysMode is <see cref="DaysModes.Short"/>
        /// </summary>
        /// <param name="e">Paint info</param>
        public override void OnDrawDayNameHeader(CalendarRendererBoxEventArgs e)
        {
            e.TextColor = ColorTable.WeekDayName;
            base.OnDrawDayNameHeader(e);

            // гр╢╒м╨Ю╩Г╧ 3 ат╣т
            using (Pen p = new Pen(ColorTable.WeekHeaderBorder))
            {
                Rectangle bounds = e.Bounds;
                bounds.Height--;
                e.Graphics.DrawRectangle(p, bounds);

                bounds.Y++;
                bounds.Height--;
                p.Color = Color.WhiteSmoke;
                e.Graphics.DrawLine(p, e.Bounds.Left, e.Bounds.Top, e.Bounds.Left, e.Bounds.Bottom);
                e.Graphics.DrawLine(p, e.Bounds.Left, e.Bounds.Top, e.Bounds.Right, e.Bounds.Top);
            }
        }
예제 #8
0
        /// <summary>
        /// Paints a name of the day column whenCalendar.DaysMode is <see cref="DaysModes.Short"/>
        /// </summary>
        /// <param name="e">Paint info</param>
        public override void OnDrawDayNameHeader(CalendarRendererBoxEventArgs e)
        {
            e.TextColor = ColorTable.WeekDayName;
            //e.BackgroundColor = ColorTable.DayTopBackground;

            GlossyRect(e.Graphics, e.Bounds, HeaderA, HeaderB, HeaderC, HeaderD);

            base.DrawStandarBoxText(e);
            //base.OnDrawDayNameHeader(e);

            // гр╢╒м╨Ю╩Г╧ 3 ат╣т
            using (Pen p = new Pen(ColorTable.WeekHeaderBorder))
            {
                Rectangle bounds = e.Bounds;
                bounds.Height--;
                //e.Graphics.DrawRectangle(p, bounds);

                bounds.Y += 2;
                bounds.Height--;
                p.Color = Color.WhiteSmoke;
                e.Graphics.DrawLine(p, e.Bounds.Left, e.Bounds.Top, e.Bounds.Left, e.Bounds.Bottom);
                //e.Graphics.DrawLine(p, e.Bounds.Left, e.Bounds.Top, e.Bounds.Right, e.Bounds.Top);
            }
        }
예제 #9
0
 public override void OnDrawTimeScaleMinutes(CalendarRendererBoxEventArgs e)
 {
     e.TextColor = ColorTable.TimeScaleMinutes;
     base.OnDrawTimeScaleMinutes(e);
 }
예제 #10
0
        public override void OnDrawItemText(CalendarRendererBoxEventArgs e)
        {
            CalendarItem item = e.Tag as CalendarItem;
            
            if (item != null)
            {
                if (item.IsDragging)
                {
                    e.TextColor = Color.FromArgb(120, e.TextColor);
                }
            }

            base.OnDrawItemText(e);
        }
예제 #11
0
 public override void OnDrawTimeScaleMinutes(CalendarRendererBoxEventArgs e)
 {
     e.TextColor = ColorTable.TimeScaleMinutes;
     base.OnDrawTimeScaleMinutes(e);
 }
예제 #12
0
 /// <summary>
 /// Paints a name of the day column when <see cref="Calendar.DaysMode"/> is <see cref="CalendarDaysMode.Short"/>
 /// </summary>
 /// <param name="e">Paint info</param>
 public virtual void OnDrawDayNameHeader(CalendarRendererBoxEventArgs e)
 {
     DrawStandarBoxText(e);
 }
예제 #13
0
        /// <summary>
        /// Paints the specified day on the calendar
        /// </summary>
        /// <param name="e">Paint info</param>
        public virtual void OnDrawDay(CalendarRendererDayEventArgs e)
        {
            CalendarDay day = e.Day;

            CalendarRendererBoxEventArgs hevt = new CalendarRendererBoxEventArgs(e,
                    day.HeaderBounds,
                    day.Date.Day.ToString(),
                    TextFormatFlags.VerticalCenter);
            hevt.Font = new Font(Calendar.Font, FontStyle.Bold);

            CalendarRendererBoxEventArgs devt = new CalendarRendererBoxEventArgs(e,
                    day.HeaderBounds,
                    day.Date.ToString("dddd"),
                    TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter);

            OnDrawDayHeaderBackground(e);

            if (Calendar.DaysMode == CalendarDaysMode.Short && (day.Index == 0 || day.Date.Day == 1))
            {
                hevt.Text = day.Date.ToString("dd MMM");
            }

            OnDrawDayHeaderText(hevt);

            if (devt.TextSize.Width < day.HeaderBounds.Width - hevt.TextSize.Width * 2
                && e.Calendar.DaysMode == CalendarDaysMode.Expanded)
            {
                OnDrawDayHeaderText(devt);
            }

            

            OnDrawDayTimeUnits(e);
            OnDrawDayTop(e);
            OnDrawDayBorder(e);
        }
예제 #14
0
 /// <summary>
 /// Paints minutes of a timescale unit
 /// </summary>
 /// <param name="e">Paint Info</param>
 public virtual void OnDrawTimeScaleMinutes(CalendarRendererBoxEventArgs e)
 {
     DrawStandarBoxText(e);
 }
예제 #15
0
        /// <summary>
        /// Paints the timescale of the calendar
        /// </summary>
        /// <param name="e">Paint info</param>
        public virtual void OnDrawTimeScale(CalendarRendererEventArgs e)
        {
            if (e.Calendar.DaysMode == CalendarDaysMode.Short
                || e.Calendar.Days == null
                || e.Calendar.Days.Length == 0
                || e.Calendar.Days[0].TimeUnits == null
                ) return;

            Font hourFont = new Font(e.Calendar.Font.FontFamily, e.Calendar.Font.Size * (e.Calendar.TimeScale == CalendarTimeScale.SixtyMinutes ? 0.5f : 0.8f));
            Font minuteFont = hourFont; // e.Calendar.Font * 0.8f;
            int hourLeft = TimeScaleBounds.Left;
            int hourWidth = TimeScaleBounds.Left + TimeScaleBounds.Width / 2;
            int minuteLeft = hourLeft + hourWidth;
            int minuteWidth = hourWidth;
            int k = 0;

            for (int i = 0; i < e.Calendar.Days[0].TimeUnits.Length; i++)
            {
                CalendarTimeScaleUnit unit = e.Calendar.Days[0].TimeUnits[i];

                if (!unit.Visible) continue;

                string hours = unit.Hours.ToString("00");
                string minutes = unit.Minutes == 0 ? "00" : string.Empty;

                if (!string.IsNullOrEmpty(minutes))
                {
                    if (hours == "00") hours = "12";

                    CalendarRendererBoxEventArgs hevt = new CalendarRendererBoxEventArgs(e, new Rectangle(hourLeft, unit.Bounds.Top, hourWidth, unit.Bounds.Height), hours, TextFormatFlags.Right);

                    hevt.Font = hourFont;

                    OnDrawTimeScaleHour(hevt);

                    if (k++ == 0 || unit.Hours == 0 || unit.Hours == 12 ) minutes = unit.Date.ToString("tt");

                    CalendarRendererBoxEventArgs mevt = new CalendarRendererBoxEventArgs(e, new Rectangle(minuteLeft, unit.Bounds.Top, minuteWidth, unit.Bounds.Height), minutes, TextFormatFlags.Top | TextFormatFlags.Left);

                    mevt.Font = minuteFont;

                    OnDrawTimeScaleMinutes(mevt);
                }
            }
        }
예제 #16
0
 /// <summary>
 /// Draws text using the information of the <see cref="CalendarRendererBoxEventArgs"/>
 /// </summary>
 /// <param name="e"></param>
 protected virtual void DrawStandarBoxText(CalendarRendererBoxEventArgs e)
 {
     TextRenderer.DrawText(e.Graphics, e.Text, e.Font, e.Bounds, e.TextColor, e.Format);
 }
예제 #17
0
        public override void OnDrawWeekHeader(CalendarRendererBoxEventArgs e)
        {
            using (Brush b = new SolidBrush(ColorTable.WeekHeaderBackground))
            {
                e.Graphics.FillRectangle(b, e.Bounds);
            }

            using (Pen p = new Pen(ColorTable.WeekHeaderBorder))
            {
                e.Graphics.DrawRectangle(p, e.Bounds);
            }

            e.TextColor = ColorTable.WeekHeaderText;

            base.OnDrawWeekHeader(e);
        }
예제 #18
0
        /// <summary>
        /// Draws the strings of an item. Strings inlude StartTime, EndTime and Text
        /// </summary>
        /// <param name="e">Event Info</param>
        public virtual void OnDrawItemContent(CalendarRendererItemBoundsEventArgs e)
        {
            if (e.Item == e.Calendar.EditModeItem) return;

            List<Rectangle> rectangles = new List<Rectangle>(e.Item.GetAllBounds());

            for (int i = 0; i < rectangles.Count; i++)
            {
                Rectangle bounds = rectangles[i];
                Rectangle imageBounds = Rectangle.Empty;
                Rectangle rStartTime = new Rectangle();
                Rectangle rEndTime = new Rectangle();
                string endTime = string.Empty;
                string startTime = string.Empty;
                Color secondaryForecolor = e.Item.ForeColor;

                if (e.Item.ShowEndTime && i == rectangles.Count - 1)
                {
                    endTime = e.Item.EndDateText;
                    rEndTime = new Rectangle(Point.Empty, TextRenderer.MeasureText(endTime, e.Calendar.Font));
                    rEndTime = Rectangle.FromLTRB(bounds.Right - rEndTime.Width - ItemTextMargin.Right,
                        bounds.Top + ItemTextMargin.Top,
                        bounds.Right - ItemTextMargin.Right,
                        bounds.Bottom - ItemTextMargin.Bottom);
                    OnDrawItemEndTime(new CalendarRendererBoxEventArgs(e, rEndTime, endTime, secondaryForecolor));
                }

                if (e.Item.ShowStartTime && i == 0)
                {
                    startTime = e.Item.StartDateText;
                    rStartTime = new Rectangle(Point.Empty, TextRenderer.MeasureText(startTime, e.Calendar.Font));
                    rStartTime.X = bounds.Left + ItemTextMargin.Left;
                    rStartTime.Y = bounds.Top + ItemTextMargin.Top;
                    rStartTime.Height = bounds.Height - ItemTextMargin.Vertical;
                    OnDrawItemStartTime(new CalendarRendererBoxEventArgs(e, rStartTime, startTime, secondaryForecolor));
                }

                Rectangle r = Rectangle.FromLTRB(
                    bounds.Left + ItemTextMargin.Left + rStartTime.Width,
                    bounds.Top + ItemTextMargin.Top,
                    bounds.Right - ItemTextMargin.Right - rEndTime.Width,
                    bounds.Bottom - ItemTextMargin.Bottom);

                CalendarRendererBoxEventArgs evt = new CalendarRendererBoxEventArgs(e, r, e.Item.Text, TextFormatFlags.Left | TextFormatFlags.Top);

                if (e.Item.ShowStartTime || e.Item.ShowEndTime) 
                    evt.Font = new Font(evt.Font, FontStyle.Bold);

                if (e.Item.IsOnDayTop || Calendar.DaysMode == CalendarDaysMode.Short)
                    evt.Format |= TextFormatFlags.HorizontalCenter;

                if (!e.Item.ForeColor.IsEmpty)
                {
                    evt.TextColor = e.Item.ForeColor;
                }

                evt.Tag = e.Item;

                #region Image

                if (e.Item.Image != null)
                {
                    Rectangle tBounds = e.Item.Bounds;
                    imageBounds.Size = e.Item.Image.Size;

                    switch (e.Item.ImageAlign)
                    {
                        case CalendarItemImageAlign.North:
                            tBounds.Height -= imageBounds.Height;
                            tBounds.Y += imageBounds.Height;
                            imageBounds.Y = tBounds.Y - imageBounds.Height;
                            break;
                        case CalendarItemImageAlign.South:
                            tBounds.Height -= imageBounds.Height;
                            imageBounds.Y = tBounds.Bottom;
                            break;
                        case CalendarItemImageAlign.East:
                            tBounds.Width -= imageBounds.Width;
                            imageBounds.X = tBounds.Right;
                            break;
                        case CalendarItemImageAlign.West:
                            tBounds.Width -= imageBounds.Width;
                            tBounds.X += imageBounds.Width;
                            imageBounds.X = tBounds.Left - imageBounds.Width;
                            break;
                    }

                    switch (e.Item.ImageAlign)
                    {
                        case CalendarItemImageAlign.North:
                        case CalendarItemImageAlign.South:
                            imageBounds.X = e.Item.Bounds.X + ( ( e.Item.Bounds.Width - imageBounds.Width ) / 2);
                            break;
                        case CalendarItemImageAlign.East:
                        case CalendarItemImageAlign.West:
                            imageBounds.Y = e.Item.Bounds.Y + ((e.Item.Bounds.Height - imageBounds.Height) / 2);
                            break;
                    }

                    evt.Bounds = tBounds;
                    OnDrawItemImage(new CalendarRendererItemBoundsEventArgs(e, imageBounds, false, false));
                }

                #endregion

                OnDrawItemText(evt);
            }
        }
예제 #19
0
        public override void OnDrawItemEndTime(CalendarRendererBoxEventArgs e)
        {
            if (e.TextColor.IsEmpty)
            {
                e.TextColor = ColorTable.ItemSecondaryText;
            }

            base.OnDrawItemEndTime(e);
        }
예제 #20
0
 /// <summary>
 /// Draws the end time of the item if applicable
 /// </summary>
 /// <param name="e">Event data</param>
 public virtual void OnDrawItemEndTime(CalendarRendererBoxEventArgs e)
 {
     DrawStandarBoxText(e);
 }
예제 #21
0
        public override void OnDrawDayNameHeader(CalendarRendererBoxEventArgs e)
        {
            e.TextColor = ColorTable.WeekDayName;

            base.OnDrawDayNameHeader(e);

            using (Pen p = new Pen(ColorTable.WeekDayName))
            {
                e.Graphics.DrawLine(p, e.Bounds.Right, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom);
            }
        }
예제 #22
0
        /// <summary>
        /// Paints the header of a week row when <see cref="Calendar.DaysMode"/> is <see cref="CalendarDaysMode.Short"/>
        /// </summary>
        /// <param name="e">Paint info</param>
        public virtual void OnDrawWeekHeader(CalendarRendererBoxEventArgs e)
        {
            StringFormat sf = new StringFormat();
            sf.FormatFlags = StringFormatFlags.DirectionVertical | StringFormatFlags.DirectionRightToLeft | StringFormatFlags.NoWrap;
            sf.LineAlignment = StringAlignment.Center;
            sf.Alignment = StringAlignment.Center;

            using (SolidBrush b = new SolidBrush(e.TextColor))
            {
                e.Graphics.DrawString(e.Text, e.Font, b, e.Bounds, sf);
            }

            e.Graphics.ResetTransform();

            sf.Dispose();
        }