Esempio n. 1
0
        /// <summary>
        /// Draws transparent element with container's width in default. If element is dragged over highlights Time windows of dregged order.
        /// </summary>
        /// <param name="context">Drawing context.</param>
        public void Draw(GanttItemElementDrawingContext context)
        {
            Rect elementSize = new Rect(context.DrawingArea.X, context.DrawingArea.Top, context.DrawingArea.Width, context.DrawingArea.Height);

            SolidColorBrush fillBrush = new SolidColorBrush(Colors.Transparent);
            Pen             drawPen   = GanttControlHelper.GetPen();

            // Draw element.
            context.DrawingContext.DrawRectangle(fillBrush, drawPen, elementSize);

            // Draw dragged over element.
            if (context.DrawDraggedOver)
            {
                Debug.Assert(ParentGanttItem.Tag != null);

                Brush draggedOverBrush = GanttControlHelper.GetEmptyElementDragOverFillBrush(((Route)ParentGanttItem.Tag).Color);
                Pen   pen = new Pen(fillBrush, 0);
                pen.Freeze();

                // Define collection of highlighted rectangles.
                Collection <Rect> highlightedRects = _GetHighlightedRects(context);

                if (highlightedRects == null)
                {
                    return;
                }

                // Draw dragged over areas.
                foreach (Rect rect in highlightedRects)
                {
                    context.DrawingContext.DrawRoundedRectangle(draggedOverBrush, pen, rect, ROUND_RADIUS, ROUND_RADIUS);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Draws internal gradient effect.
        /// </summary>
        /// <param name="context">Drawing context.</param>
        private static void _DrawGradientEffect(GanttItemElementDrawingContext context)
        {
            Rect  elementRect   = _GetGradientRect(context);
            Brush gradientBrush = GanttControlHelper.GetGradientEffectBrush();
            Pen   drawPen       = GanttControlHelper.GetPen();

            context.DrawingContext.DrawRoundedRectangle(gradientBrush, drawPen, elementRect, ROUND_RADIUS, ROUND_RADIUS);
        }
Esempio n. 3
0
        /// <summary>
        /// Draws gantt item element.
        /// </summary>
        /// <param name="fillBrush">Filling brush.</param>
        /// <param name="context">Context.</param>
        private static void _DrawRectangle(Brush fillBrush, GanttItemElementDrawingContext context)
        {
            // Draw shadow effect.
            _DrawShadowEffect(context);

            Rect elementRect = _GetElementRect(context);
            Pen  drawPen     = GanttControlHelper.GetPen();

            // Draw rectangle.
            context.DrawingContext.DrawRoundedRectangle(fillBrush, drawPen, elementRect, ROUND_RADIUS, ROUND_RADIUS);

            // Draw top gradient effect.
            _DrawGradientEffect(context);
        }
Esempio n. 4
0
        public void Draw(GanttItemElementDrawingContext context)
        {
            Debug.Assert(_stop != null);
            Debug.Assert(_route != null);

            // Define element size.
            double yPos        = context.DrawingArea.Top + context.DrawingArea.Height / HEIGHT_INDEX;
            double height      = context.DrawingArea.Height / HEIGHT_INDEX;
            Rect   elementSize = new Rect(context.DrawingArea.X, yPos, context.DrawingArea.Width, height);

            Brush fillBrush = _GetFillBrush(context);
            Pen   drawPen   = GanttControlHelper.GetPen();

            // Draw element.
            context.DrawingContext.DrawRoundedRectangle(fillBrush, drawPen, elementSize, ROUND_RADIUS, ROUND_RADIUS);
        }