/// <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="ChartService"/> control that owns the annotation. /// </param> override internal void Paint(ChartService chart, ChartGraphics graphics) { // Get annotation position in relative coordinates GetRelativePosition(out SKPoint firstPoint, out SKSize size, out _); SKPoint secondPoint = new(firstPoint.X + size.Width, firstPoint.Y + size.Height); // Create selection rectangle SKRect selectionRect = new(firstPoint.X, firstPoint.Y, secondPoint.X, secondPoint.Y); // Get text position SKRect rectanglePosition = new(selectionRect.Left, selectionRect.Top, selectionRect.Right, selectionRect.Bottom); if (rectanglePosition.Width < 0 || rectanglePosition.Height < 0) { rectanglePosition = rectanglePosition.Standardized; } // Check if position is valid if (float.IsNaN(rectanglePosition.Left) || float.IsNaN(rectanglePosition.Top) || float.IsNaN(rectanglePosition.Right) || float.IsNaN(rectanglePosition.Bottom)) { return; } if (Common.ProcessModePaint) { // Do not draw border if size is less that 10 pixels SKRect absRectanglePosition = graphics.GetAbsoluteRectangle(rectanglePosition); if (absRectanglePosition.Width > 30f && absRectanglePosition.Height > 30f) { // Draw rectangle graphics.Draw3DBorderRel( _borderSkin, rectanglePosition, BackColor, BackHatchStyle, String.Empty, ChartImageWrapMode.Scaled, SKColor.Empty, ChartImageAlignmentStyle.Center, BackGradientStyle, BackSecondaryColor, LineColor, LineWidth, LineDashStyle); } } // Call base class to paint text, selection handles and process hot regions base.Paint(chart, graphics); }