コード例 #1
0
        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 color1 = Colors.White;
            Color color2 = e.Item.Selected ? ColorTable.ItemSelectedBackground : ColorTable.ItemBackground;

            if (!e.Item.BackgroundColorLighter.IsEmpty)
            {
                color1 = e.Item.BackgroundColorLighter;
            }

            if (!e.Item.BackgroundColors.IsEmpty)
            {
                color2 = e.Item.BackgroundColor;
            }

            ItemFill(e, e.Bounds, Colors.FromArgb(alpha, color1), Colors.FromArgb(alpha, color2));
        }
コード例 #2
0
        public override void OnDrawItemBorder(CalendarRendererItemBoundsEventArgs e)
        {
            base.OnDrawItemBorder(e);

            Color a = e.Item.BorderColors.IsEmpty ? ColorTable.ItemBorder : e.Item.BorderColor;
            Color b = e.Item.Selected && !e.Item.IsDragging ? ColorTable.ItemSelectedBorder : a;
            Color c = Colors.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);
            Pen p = new Pen(new SolidColorBrush(Color.FromArgb(150, Colors.White.R, Colors.White.G, Colors.White.B)), penThickness);

            e.DrawingContext.DrawLine(p, new Point(e.Bounds.Left + ItemRoundness, e.Bounds.Top + 1), new Point(e.Bounds.Right - ItemRoundness, e.Bounds.Top + 1));


            if (e.Item.Selected && !e.Item.IsDragging)
            {
                bool horizontal = false;
                bool vertical   = false;
                Rect r1         = new Rect(0, 0, 5, 5);
                Rect r2         = new Rect(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.DrawingContext.DrawRect(Brushes.White, new Pen(), r1);
                        e.DrawingContext.DrawRect(Brushes.Black, new Pen(), r1);
                    }

                    if (!e.Item.IsOpenEnd && e.IsLast)
                    {
                        e.DrawingContext.DrawRect(Brushes.White, new Pen(), r2);
                        e.DrawingContext.DrawRect(Brushes.Black, new Pen(), r2);
                    }
                }
            }
        }
コード例 #4
0
        public override void OnDrawItemShadow(CalendarRendererItemBoundsEventArgs e)
        {
            base.OnDrawItemShadow(e);

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

            Rect r = e.Bounds;

            r.Offset(ItemShadowPadding, ItemShadowPadding);

            using (SolidColorBrush b = new SolidColorBrush(ColorTable.ItemShadow))
            {
                ItemFill(e, r, ColorTable.ItemShadow, ColorTable.ItemShadow);
            }
        }