public override void OnDrawItemBackground(CalendarRendererItemBoundsEventArgs e)
        {
            base.OnDrawItemBackground(e);

            int alpha = 255;

            if (e.Item.IsDragging)
            {
                alpha = 120;
            }
            else if (e.Calendar.DaysMode == CalendarDaysMode.SHORT)
            {
                alpha = 200;
            }

            Color colour1 = Color.White;
            Color colour2 = e.Item.Selected ? ColourTable.ItemSelectedBackground : ColourTable.ItemBackground;

            if (!e.Item.BackgroundColourLighter.IsEmpty)
            {
                colour1 = e.Item.BackgroundColourLighter;
            }

            if (!e.Item.BackgroundColour.IsEmpty)
            {
                colour2 = e.Item.BackgroundColour;
            }

            ItemFill(e, e.Bounds, Color.FromArgb(alpha, colour1), Color.FromArgb(alpha, colour2));
        }
        public override void OnDrawItemBorder(CalendarRendererItemBoundsEventArgs e)
        {
            base.OnDrawItemBorder(e);

            Color a = e.Item.BorderColour.IsEmpty ? ColourTable.ItemBorder : e.Item.BorderColour;
            Color b = e.Item.Selected && !e.Item.IsDragging ? ColourTable.ItemSelectedBorder : a;
            Color c = Color.FromArgb(e.Item.IsDragging ? 120 : 255, b);

            ItemBorder(e, e.Bounds, c, e.Item.Selected && !e.Item.IsDragging ? SelectedItemBorder : 1f);
        }
示例#3
0
        public override void OnDrawItemBorder(CalendarRendererItemBoundsEventArgs e)
        {
            base.OnDrawItemBorder(e);

            using (Pen p = new Pen(_palette.ColorTable.MenuItemSelectedGradientBegin))
            {
                e.Graphics.DrawLine(p, e.Bounds.Left + ItemRoundness, e.Bounds.Top + 1, e.Bounds.Right - ItemRoundness, e.Bounds.Top + 1);
            }

            if (e.Item.Selected && !e.Item.IsDragging)
            {
                bool      horizontal = false;
                bool      vertical   = false;
                Rectangle r1         = new Rectangle(0, 0, 5, 5);
                Rectangle r2         = new Rectangle(0, 0, 5, 5);

                horizontal = e.Item.IsOnDayTop;
                vertical   = !e.Item.IsOnDayTop && e.Calendar.DaysMode == CalendarDaysMode.EXPANDED;

                if (horizontal)
                {
                    r1.X = e.Bounds.Left - 2;
                    r2.X = e.Bounds.Right - r1.Width + 2;
                    r1.Y = e.Bounds.Top + (e.Bounds.Height - r1.Height) / 2;
                    r2.Y = r1.Y;
                }

                if (vertical)
                {
                    r1.Y = e.Bounds.Top - 2;
                    r2.Y = e.Bounds.Bottom - r1.Height + 2;
                    r1.X = e.Bounds.Left + (e.Bounds.Width - r1.Width) / 2;
                    r2.X = r1.X;
                }

                if ((horizontal || vertical) && Calendar.AllowItemResize)
                {
                    if (!e.Item.IsOpenStart && e.IsFirst)
                    {
                        e.Graphics.FillRectangle(Brushes.White, r1);
                        e.Graphics.DrawRectangle(Pens.Red, r1);
                    }

                    if (!e.Item.IsOpenEnd && e.IsLast)
                    {
                        e.Graphics.FillRectangle(Brushes.White, r2);
                        e.Graphics.DrawRectangle(Pens.Red, r2);
                    }
                }
            }
        }
        public override void OnDrawItemShadow(CalendarRendererItemBoundsEventArgs e)
        {
            base.OnDrawItemShadow(e);

            if (e.Item.IsOnDayTop || e.Calendar.DaysMode == CalendarDaysMode.SHORT || e.Item.IsDragging)
            {
                return;
            }

            Rectangle r = e.Bounds;

            r.Offset(ItemShadowPadding, ItemShadowPadding);

            using (SolidBrush b = new SolidBrush(ColourTable.ItemShadow))
            {
                ItemFill(e, r, ColourTable.ItemShadow, ColourTable.ItemShadow);
            }
        }