/// <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); }