/// <summary>
        /// Gets text annotation content size based on the text and font.
        /// </summary>
        /// <returns>Annotation content position.</returns>
        override internal RectangleF GetContentPosition()
        {
            // Check image size
            if (this.Image.Length > 0)
            {
                // Try loading image and getting its size
                try
                {
                    if (this.Chart != null)
                    {
                        ImageLoader imageLoader = this.Common.ImageLoader;

                        if (imageLoader != null)
                        {
                            ChartGraphics chartGraphics = this.GetGraphics();

                            if (chartGraphics != null)
                            {
                                SizeF absSize = new SizeF();

                                if (imageLoader.GetAdjustedImageSize(this.Image, chartGraphics.Graphics, ref absSize))
                                {
                                    SizeF imageSize = chartGraphics.GetRelativeSize(absSize);
                                    return(new RectangleF(float.NaN, float.NaN, imageSize.Width, imageSize.Height));
                                }
                            }
                        }
                    }
                }
                catch (ArgumentException)
                {
                    // ArgumentException is thrown by LoadImage in certain situations when it can't load the image
                }
            }

            return(new RectangleF(float.NaN, float.NaN, float.NaN, float.NaN));
        }
        /// <summary>
        /// Draw strip/line title text
        /// </summary>
        /// <param name="graph">Chart graphics object.</param>
        /// <param name="rect">Rectangle to draw in.</param>
        private void PaintTitle(ChartGraphics graph, RectangleF rect)
        {
            if (this.Text.Length > 0)
            {
                // Get title text
                string titleText = this.Text;

                // Prepare string format
                using (StringFormat format = new StringFormat())
                {
                    format.Alignment = this.TextAlignment;

                    if (graph.IsRightToLeft)
                    {
                        if (format.Alignment == StringAlignment.Far)
                        {
                            format.Alignment = StringAlignment.Near;
                        }
                        else if (format.Alignment == StringAlignment.Near)
                        {
                            format.Alignment = StringAlignment.Far;
                        }
                    }

                    format.LineAlignment = this.TextLineAlignment;

                    // Adjust default title angle for horizontal lines
                    int angle = 0;
                    switch (this.TextOrientation)
                    {
                    case (TextOrientation.Rotated90):
                        angle = 90;
                        break;

                    case (TextOrientation.Rotated270):
                        angle = 270;
                        break;

                    case (TextOrientation.Auto):
                        if (this.Axis.AxisPosition == AxisPosition.Bottom || this.Axis.AxisPosition == AxisPosition.Top)
                        {
                            angle = 270;
                        }
                        break;
                    }

                    // Set vertical text for horizontal lines
                    if (angle == 90)
                    {
                        format.FormatFlags = StringFormatFlags.DirectionVertical;
                        angle = 0;
                    }
                    else if (angle == 270)
                    {
                        format.FormatFlags = StringFormatFlags.DirectionVertical;
                        angle = 180;
                    }

                    // Measure string size
                    SizeF size = graph.MeasureStringRel(titleText.Replace("\\n", "\n"), this.Font, new SizeF(100, 100), format, this.GetTextOrientation());

                    // Adjust text size
                    float zPositon = 0f;
                    if (this.Axis.ChartArea.Area3DStyle.Enable3D)
                    {
                        // Get projection coordinates
                        Point3D[] textSizeProjection = new Point3D[3];
                        zPositon = this.Axis.ChartArea.IsMainSceneWallOnFront() ? this.Axis.ChartArea.areaSceneDepth : 0f;
                        textSizeProjection[0] = new Point3D(0f, 0f, zPositon);
                        textSizeProjection[1] = new Point3D(size.Width, 0f, zPositon);
                        textSizeProjection[2] = new Point3D(0f, size.Height, zPositon);

                        // Transform coordinates of text size
                        this.Axis.ChartArea.matrix3D.TransformPoints(textSizeProjection);

                        // Adjust text size
                        int index = this.Axis.ChartArea.IsMainSceneWallOnFront() ? 0 : 1;
                        size.Width  *= size.Width / (textSizeProjection[index].X - textSizeProjection[(index == 0) ? 1 : 0].X);
                        size.Height *= size.Height / (textSizeProjection[2].Y - textSizeProjection[0].Y);
                    }


                    // Get relative size of the border width
                    SizeF sizeBorder = graph.GetRelativeSize(new SizeF(this.BorderWidth, this.BorderWidth));

                    // Find the center of rotation
                    PointF rotationCenter = PointF.Empty;
                    if (format.Alignment == StringAlignment.Near)
                    { // Near
                        rotationCenter.X = rect.X + size.Width / 2 + sizeBorder.Width;
                    }
                    else if (format.Alignment == StringAlignment.Far)
                    { // Far
                        rotationCenter.X = rect.Right - size.Width / 2 - sizeBorder.Width;
                    }
                    else
                    { // Center
                        rotationCenter.X = (rect.Left + rect.Right) / 2;
                    }

                    if (format.LineAlignment == StringAlignment.Near)
                    { // Near
                        rotationCenter.Y = rect.Top + size.Height / 2 + sizeBorder.Height;
                    }
                    else if (format.LineAlignment == StringAlignment.Far)
                    { // Far
                        rotationCenter.Y = rect.Bottom - size.Height / 2 - sizeBorder.Height;
                    }
                    else
                    { // Center
                        rotationCenter.Y = (rect.Bottom + rect.Top) / 2;
                    }

                    // Reset string alignment to center point
                    format.Alignment     = StringAlignment.Center;
                    format.LineAlignment = StringAlignment.Center;

                    if (this.Axis.ChartArea.Area3DStyle.Enable3D)
                    {
                        // Get projection coordinates
                        Point3D[] rotationCenterProjection = new Point3D[2];
                        rotationCenterProjection[0] = new Point3D(rotationCenter.X, rotationCenter.Y, zPositon);
                        if (format.FormatFlags == StringFormatFlags.DirectionVertical)
                        {
                            rotationCenterProjection[1] = new Point3D(rotationCenter.X, rotationCenter.Y - 20f, zPositon);
                        }
                        else
                        {
                            rotationCenterProjection[1] = new Point3D(rotationCenter.X - 20f, rotationCenter.Y, zPositon);
                        }

                        // Transform coordinates of text rotation point
                        this.Axis.ChartArea.matrix3D.TransformPoints(rotationCenterProjection);

                        // Adjust rotation point
                        rotationCenter = rotationCenterProjection[0].PointF;

                        // Adjust angle of the text
                        if (angle == 0 || angle == 180 || angle == 90 || angle == 270)
                        {
                            if (format.FormatFlags == StringFormatFlags.DirectionVertical)
                            {
                                angle += 90;
                            }

                            // Convert coordinates to absolute
                            rotationCenterProjection[0].PointF = graph.GetAbsolutePoint(rotationCenterProjection[0].PointF);
                            rotationCenterProjection[1].PointF = graph.GetAbsolutePoint(rotationCenterProjection[1].PointF);

                            // Calcuate axis angle
                            float angleXAxis = (float)Math.Atan(
                                (rotationCenterProjection[1].Y - rotationCenterProjection[0].Y) /
                                (rotationCenterProjection[1].X - rotationCenterProjection[0].X));
                            angleXAxis = (float)Math.Round(angleXAxis * 180f / (float)Math.PI);
                            angle     += (int)angleXAxis;
                        }
                    }

                    // Draw string
                    using (Brush brush = new SolidBrush(this.ForeColor))
                    {
                        graph.DrawStringRel(
                            titleText.Replace("\\n", "\n"),
                            this.Font,
                            brush,
                            rotationCenter,
                            format,
                            angle,
                            this.GetTextOrientation());
                    }
                }
            }
        }
        /// <summary>
        /// Draw strip(s) or line(s).
        /// </summary>
        /// <param name="graph">Reference to the Chart Graphics object.</param>
        /// <param name="common">Common objects.</param>
        /// <param name="drawLinesOnly">Indicates if Lines or Stripes should be drawn.</param>
        internal void Paint(
            ChartGraphics graph,
            CommonElements common,
            bool drawLinesOnly)
        {
            // Strip lines are not supported in circular chart area
            if (this.Axis.ChartArea.chartAreaIsCurcular)
            {
                return;
            }

            // Get plot area position
            RectangleF plotAreaPosition = this.Axis.ChartArea.PlotAreaPosition.ToRectangleF();

            // Detect if strip/line is horizontal or vertical
            bool horizontal = true;

            if (this.Axis.AxisPosition == AxisPosition.Bottom || this.Axis.AxisPosition == AxisPosition.Top)
            {
                horizontal = false;
            }

            // Get first series attached to this axis
            Series axisSeries = null;

            if (Axis.axisType == AxisName.X || Axis.axisType == AxisName.X2)
            {
                List <string> seriesArray = Axis.ChartArea.GetXAxesSeries((Axis.axisType == AxisName.X) ? AxisType.Primary : AxisType.Secondary, Axis.SubAxisName);
                if (seriesArray.Count > 0)
                {
                    axisSeries = Axis.Common.DataManager.Series[seriesArray[0]];
                    if (axisSeries != null && !axisSeries.IsXValueIndexed)
                    {
                        axisSeries = null;
                    }
                }
            }

            // Get starting position from axis
            // NOTE: Starting position was changed from "this.Axis.minimum" to
            // fix the minimum scaleView location to fix issue #5962 -- AG
            double currentPosition = this.Axis.ViewMinimum;

            // Adjust start position depending on the interval type
            if (!Axis.ChartArea.chartAreaIsCurcular ||
                Axis.axisType == AxisName.Y ||
                Axis.axisType == AxisName.Y2)
            {
                double intervalToUse = this.Interval;

                // NOTE: fix for issue #5962
                // Always use original grid interval for isInterlaced strip lines.
                if (this.interlaced)
                {
                    // Automaticly generated isInterlaced strips have interval twice as big as major grids
                    intervalToUse /= 2.0;
                }
                currentPosition = ChartHelper.AlignIntervalStart(currentPosition, intervalToUse, this.IntervalType, axisSeries);
            }

            // Too many tick marks
            if (this.Interval != 0)
            {
                if ((Axis.ViewMaximum - Axis.ViewMinimum) / ChartHelper.GetIntervalSize(currentPosition, this._interval, this._intervalType, axisSeries, 0, DateTimeIntervalType.Number, false) > ChartHelper.MaxNumOfGridlines)
                {
                    return;
                }
            }

            DateTimeIntervalType offsetType = (IntervalOffsetType == DateTimeIntervalType.Auto) ? IntervalType : IntervalOffsetType;

            if (this.Interval == 0)
            {
                currentPosition = this.IntervalOffset;
            }

            /******************************************************************
             * Removed by AG. Causing issues with interalced strip lines.
             * /******************************************************************
             * else if(axisSeries != null && axisSeries.IsXValueIndexed)
             * {
             *      // Align first position for indexed series
             *      currentPosition += this.Axis.AlignIndexedIntervalStart(
             *              currentPosition,
             *              this.Interval,
             *              this.IntervalType,
             *              axisSeries,
             *              this.IntervalOffset,
             *              offsetType,
             *              false);
             * }
             */
            else
            {
                if (this.IntervalOffset > 0)
                {
                    currentPosition += ChartHelper.GetIntervalSize(currentPosition, this.IntervalOffset,
                                                                   offsetType, axisSeries, 0, DateTimeIntervalType.Number, false);
                }
                else if (this.IntervalOffset < 0)
                {
                    currentPosition -= ChartHelper.GetIntervalSize(currentPosition, -this.IntervalOffset,
                                                                   offsetType, axisSeries, 0, DateTimeIntervalType.Number, false);
                }
            }

            // Draw several lines or strips if Interval property is set
            int counter = 0;

            do
            {
                // Check if we do not exceed max number of elements
                if (counter++ > ChartHelper.MaxNumOfGridlines)
                {
                    break;
                }

                // Draw strip
                if (this.StripWidth > 0 && !drawLinesOnly)
                {
                    double stripRightPosition = currentPosition + ChartHelper.GetIntervalSize(currentPosition, this.StripWidth, this.StripWidthType, axisSeries, this.IntervalOffset, offsetType, false);
                    if (stripRightPosition > this.Axis.ViewMinimum && currentPosition < this.Axis.ViewMaximum)
                    {
                        // Calculate strip rectangle
                        RectangleF rect = RectangleF.Empty;
                        double     pos1 = (float)this.Axis.GetLinearPosition(currentPosition);
                        double     pos2 = (float)this.Axis.GetLinearPosition(stripRightPosition);
                        if (horizontal)
                        {
                            rect.X      = plotAreaPosition.X;
                            rect.Width  = plotAreaPosition.Width;
                            rect.Y      = (float)Math.Min(pos1, pos2);
                            rect.Height = (float)Math.Max(pos1, pos2) - rect.Y;

                            // Check rectangle boundaries
                            rect.Intersect(plotAreaPosition);
                        }
                        else
                        {
                            rect.Y      = plotAreaPosition.Y;
                            rect.Height = plotAreaPosition.Height;
                            rect.X      = (float)Math.Min(pos1, pos2);
                            rect.Width  = (float)Math.Max(pos1, pos2) - rect.X;

                            // Check rectangle boundaries
                            rect.Intersect(plotAreaPosition);
                        }

                        if (rect.Width > 0 && rect.Height > 0)
                        {
                            // Start Svg Selection mode
                            graph.StartHotRegion("", this._toolTip);
                            if (!this.Axis.ChartArea.Area3DStyle.Enable3D)
                            {
                                // Draw strip
                                graph.FillRectangleRel(rect,
                                                       this.BackColor, this.BackHatchStyle, this.BackImage,
                                                       this.BackImageWrapMode, this.BackImageTransparentColor, this.BackImageAlignment,
                                                       this.BackGradientStyle, this.BackSecondaryColor, this.BorderColor,
                                                       this.BorderWidth, this.BorderDashStyle, Color.Empty,
                                                       0, PenAlignment.Inset);
                            }
                            else
                            {
                                Draw3DStrip(graph, rect, horizontal);
                            }

                            // End Svg Selection mode
                            graph.EndHotRegion();

                            // Draw strip line title
                            PaintTitle(graph, rect);

                            if (common.ProcessModeRegions)
                            {
                                if (!this.Axis.ChartArea.Area3DStyle.Enable3D)
                                {
                                    common.HotRegionsList.AddHotRegion(rect, this.ToolTip, string.Empty, string.Empty, string.Empty, this, ChartElementType.StripLines, null);
                                }
                            }
                        }
                    }
                }
                // Draw line
                else if (this.StripWidth == 0 && drawLinesOnly)
                {
                    if (currentPosition > this.Axis.ViewMinimum && currentPosition < this.Axis.ViewMaximum)
                    {
                        // Calculate line position
                        PointF point1 = PointF.Empty;
                        PointF point2 = PointF.Empty;
                        if (horizontal)
                        {
                            point1.X = plotAreaPosition.X;
                            point1.Y = (float)this.Axis.GetLinearPosition(currentPosition);
                            point2.X = plotAreaPosition.Right;
                            point2.Y = point1.Y;
                        }
                        else
                        {
                            point1.X = (float)this.Axis.GetLinearPosition(currentPosition);
                            point1.Y = plotAreaPosition.Y;
                            point2.X = point1.X;
                            point2.Y = plotAreaPosition.Bottom;
                        }

                        // Start Svg Selection mode
                        graph.StartHotRegion("", this._toolTip);

                        // Draw Line
                        if (!this.Axis.ChartArea.Area3DStyle.Enable3D)
                        {
                            graph.DrawLineRel(this.BorderColor, this.BorderWidth, this.BorderDashStyle, point1, point2);
                        }
                        else
                        {
                            graph.Draw3DGridLine(this.Axis.ChartArea, _borderColor, _borderWidth, _borderDashStyle, point1, point2, horizontal, Axis.Common, this);
                        }

                        // End Svg Selection mode
                        graph.EndHotRegion();

                        // Draw strip line title
                        PaintTitle(graph, point1, point2);

                        if (common.ProcessModeRegions)
                        {
                            SizeF relBorderWidth = new SizeF(this.BorderWidth + 1, this.BorderWidth + 1);
                            relBorderWidth = graph.GetRelativeSize(relBorderWidth);
                            RectangleF lineRect = RectangleF.Empty;
                            if (horizontal)
                            {
                                lineRect.X      = point1.X;
                                lineRect.Y      = point1.Y - relBorderWidth.Height / 2f;
                                lineRect.Width  = point2.X - point1.X;
                                lineRect.Height = relBorderWidth.Height;
                            }
                            else
                            {
                                lineRect.X      = point1.X - relBorderWidth.Width / 2f;
                                lineRect.Y      = point1.Y;
                                lineRect.Width  = relBorderWidth.Width;
                                lineRect.Height = point2.Y - point1.Y;
                            }

                            common.HotRegionsList.AddHotRegion(lineRect, this.ToolTip, null, null, null, this, ChartElementType.StripLines, null);
                        }
                    }
                }

                // Go to the next line/strip
                if (this.Interval > 0)
                {
                    currentPosition += ChartHelper.GetIntervalSize(currentPosition, this.Interval, this.IntervalType, axisSeries, this.IntervalOffset, offsetType, false);
                }
            } while(this.Interval > 0 && currentPosition <= this.Axis.ViewMaximum);
        }