Esempio n. 1
0
        public override void Paint(Chart chart, ChartGraphics graphics)
        {
            this.Chart = chart;
            PointF empty  = PointF.Empty;
            PointF empty2 = PointF.Empty;
            SizeF  empty3 = SizeF.Empty;

            ((Annotation)this).GetRelativePosition(out empty, out empty3, out empty2);
            PointF     pointF      = new PointF(empty.X + empty3.Width, empty.Y + empty3.Height);
            RectangleF rectangleF  = new RectangleF(empty, new SizeF(pointF.X - empty.X, pointF.Y - empty.Y));
            RectangleF rectangleF2 = new RectangleF(rectangleF.Location, rectangleF.Size);

            if (rectangleF2.Width < 0.0)
            {
                rectangleF2.X     = rectangleF2.Right;
                rectangleF2.Width = (float)(0.0 - rectangleF2.Width);
            }
            if (rectangleF2.Height < 0.0)
            {
                rectangleF2.Y      = rectangleF2.Bottom;
                rectangleF2.Height = (float)(0.0 - rectangleF2.Height);
            }
            if (!float.IsNaN(rectangleF2.X) && !float.IsNaN(rectangleF2.Y) && !float.IsNaN(rectangleF2.Right) && !float.IsNaN(rectangleF2.Bottom))
            {
                if (this.Chart.chartPicture.common.ProcessModePaint)
                {
                    RectangleF absoluteRectangle = graphics.GetAbsoluteRectangle(rectangleF2);
                    if (absoluteRectangle.Width > 30.0 && absoluteRectangle.Height > 30.0)
                    {
                        graphics.Draw3DBorderRel(this.borderSkin, rectangleF2, this.BackColor, this.BackHatchStyle, string.Empty, ChartImageWrapMode.Scaled, Color.Empty, ChartImageAlign.Center, this.BackGradientType, this.BackGradientEndColor, this.LineColor, this.LineWidth, this.LineStyle);
                    }
                }
                base.Paint(chart, graphics);
            }
        }
Esempio n. 2
0
        internal override void Paint(Chart chart, ChartGraphics graphics)
        {
            Chart = chart;
            PointF location       = PointF.Empty;
            PointF anchorLocation = PointF.Empty;
            SizeF  size           = SizeF.Empty;

            GetRelativePosition(out location, out size, out anchorLocation);
            PointF     pointF      = new PointF(location.X + size.Width, location.Y + size.Height);
            RectangleF rectangleF  = new RectangleF(location, new SizeF(pointF.X - location.X, pointF.Y - location.Y));
            RectangleF rectangleF2 = new RectangleF(rectangleF.Location, rectangleF.Size);

            if (rectangleF2.Width < 0f)
            {
                rectangleF2.X     = rectangleF2.Right;
                rectangleF2.Width = 0f - rectangleF2.Width;
            }
            if (rectangleF2.Height < 0f)
            {
                rectangleF2.Y      = rectangleF2.Bottom;
                rectangleF2.Height = 0f - rectangleF2.Height;
            }
            if (float.IsNaN(rectangleF2.X) || float.IsNaN(rectangleF2.Y) || float.IsNaN(rectangleF2.Right) || float.IsNaN(rectangleF2.Bottom))
            {
                return;
            }
            if (Chart.chartPicture.common.ProcessModePaint)
            {
                RectangleF absoluteRectangle = graphics.GetAbsoluteRectangle(rectangleF2);
                if (absoluteRectangle.Width > 30f && absoluteRectangle.Height > 30f)
                {
                    graphics.Draw3DBorderRel(borderSkin, rectangleF2, BackColor, BackHatchStyle, string.Empty, ChartImageWrapMode.Scaled, Color.Empty, ChartImageAlign.Center, BackGradientType, BackGradientEndColor, LineColor, LineWidth, LineStyle);
                }
            }
            base.Paint(chart, graphics);
        }
Esempio n. 3
0
        /// <summary>
        /// Paints the annotation object on the specified graphics.
        /// </summary>
        /// <param name="graphics">
        /// A <see cref="ChartGraphics"/>
        /// </param>
        /// <param name="chart">
        /// Reference to the <see cref="Chart"/> control that owns the annotation.
        /// </param>
        override internal void Paint(Chart chart, ChartGraphics graphics)
        {
            // Get annotation position in relative coordinates
            PointF firstPoint  = PointF.Empty;
            PointF anchorPoint = PointF.Empty;
            SizeF  size        = SizeF.Empty;

            GetRelativePosition(out firstPoint, out size, out anchorPoint);
            PointF secondPoint = new PointF(firstPoint.X + size.Width, firstPoint.Y + size.Height);

            // Create selection rectangle
            RectangleF selectionRect = new RectangleF(firstPoint, new SizeF(secondPoint.X - firstPoint.X, secondPoint.Y - firstPoint.Y));

            // Get text position
            RectangleF rectanglePosition = new RectangleF(selectionRect.Location, selectionRect.Size);

            if (rectanglePosition.Width < 0)
            {
                rectanglePosition.X     = rectanglePosition.Right;
                rectanglePosition.Width = -rectanglePosition.Width;
            }
            if (rectanglePosition.Height < 0)
            {
                rectanglePosition.Y      = rectanglePosition.Bottom;
                rectanglePosition.Height = -rectanglePosition.Height;
            }

            // Check if position is valid
            if (float.IsNaN(rectanglePosition.X) ||
                float.IsNaN(rectanglePosition.Y) ||
                float.IsNaN(rectanglePosition.Right) ||
                float.IsNaN(rectanglePosition.Bottom))
            {
                return;
            }

            if (this.Common.ProcessModePaint)
            {
                // Do not draw border if size is less that 10 pixels
                RectangleF absRectanglePosition = graphics.GetAbsoluteRectangle(rectanglePosition);
                if (absRectanglePosition.Width > 30f &&
                    absRectanglePosition.Height > 30f)
                {
                    // Draw rectangle
                    graphics.Draw3DBorderRel(
                        _borderSkin,
                        rectanglePosition,
                        this.BackColor,
                        this.BackHatchStyle,
                        String.Empty,
                        ChartImageWrapMode.Scaled,
                        Color.Empty,
                        ChartImageAlignmentStyle.Center,
                        this.BackGradientStyle,
                        this.BackSecondaryColor,
                        this.LineColor,
                        this.LineWidth,
                        this.LineDashStyle);
                }
            }

            // Call base class to paint text, selection handles and process hot regions
            base.Paint(chart, graphics);
        }