VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Drawing Namespace / DrawingEngine Class / FillArc(IDrawingBrush,RectangleF,Single,Single) Method
Синтаксис Example Требования Смотрите также
В этом разделе
    FillArc(IDrawingBrush,RectangleF,Single,Single) Метод (DrawingEngine)
    В этом разделе
    Заполняет внутреннюю часть дуговой секции, определенной эллипсом, указанным структурой System.Drawing.RectangleF, и двумя радиальными линиями.
    Синтаксис
    'Declaration
    
    Public Sub FillArc( _
    ByVal brush
    IDrawingBrush, определяющий характеристики заливки.
    As IDrawingBrush, _
    ByVal rect
    System.Drawing.RectangleF, представляющий прямоугольные границы эллипса, из которого взята дуга.
    As System.Drawing.RectangleF, _
    ByVal startAngle
    Начальный угол дуги, измеряемый в градусах по часовой стрелке от оси X.
    As Single, _
    ByVal sweepAngle
    Угол между startAngle и концом дуги.
    As Single _
    )

    Parameters

    brush
    IDrawingBrush, определяющий характеристики заливки.
    rect
    System.Drawing.RectangleF, представляющий прямоугольные границы эллипса, из которого взята дуга.
    startAngle
    Начальный угол дуги, измеряемый в градусах по часовой стрелке от оси X.
    sweepAngle
    Угол между startAngle и концом дуги.
    Пример

    Вот пример, который показывает, как заполнить дугу с помощью движка рисования.

    
    ''' <summary>
    ''' Draws primitives (rectangle, ellipse, arc, pie, curve) on specified drawing engine.
    ''' </summary>
    ''' <param name="drawingEngine">Drawing engine.</param>
    ''' <param name="area">Area to draw objects in.</param>
    Public Shared Sub DrawPrimitivesExample(drawingEngine As DrawingEngine, area As RectangleF)
        Using brush As IDrawingBrush = drawingEngine.DrawingFactory.CreateSolidBrush(Color.LightGreen)
            Using pen As IDrawingPen = drawingEngine.DrawingFactory.CreatePen(Color.Red, 2F)
                ' draw rectangle
                Dim figureRect As New RectangleF(area.X, area.Y, area.Width * 0.47F, area.Height * 0.47F)
                drawingEngine.FillRectangle(brush, figureRect)
                drawingEngine.DrawRectangle(pen, figureRect)
    
                ' draw ellipse
                figureRect = New RectangleF(area.Width * 0.53F, area.Y, area.Width * 0.47F, area.Height * 0.47F)
                drawingEngine.FillEllipse(brush, figureRect)
                drawingEngine.DrawEllipse(pen, figureRect)
    
                ' draw arc
                figureRect = New RectangleF(area.X, area.Height * 0.53F, area.Width * 0.47F, area.Height * 0.47F)
                drawingEngine.FillArc(brush, figureRect, 90, 140)
                drawingEngine.DrawArc(pen, figureRect, 90, 140)
    
                ' draw pie
                drawingEngine.FillPie(brush, figureRect, -50, 50)
                drawingEngine.DrawPie(pen, figureRect, -50, 50)
    
                ' create graphics path
                Using path As IGraphicsPath = drawingEngine.DrawingFactory.CreateGraphicsPath()
                    ' create curve points
                    Dim startPoint As New PointF(area.Width * 0.53F, area.Height * 0.53F)
    
                    Dim curvePoints As PointF() = New PointF() {startPoint, New PointF(startPoint.X * 1.3F, startPoint.Y * 1.8F), New PointF(startPoint.X * 1.7F, startPoint.Y * 1.2F), New PointF(area.Width * 0.99F, area.Height * 0.99F)}
    
                    ' add curve to path
                    path.AddCurve(curvePoints, 0.5F)
                    ' draw path
                    drawingEngine.FillPath(brush, path)
                    drawingEngine.DrawPath(pen, path)
                End Using
            End Using
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Draws primitives (rectangle, ellipse, arc, pie, curve) on specified drawing engine.
    /// </summary>
    /// <param name="drawingEngine">Drawing engine.</param>
    /// <param name="area">Area to draw objects in.</param>
    public static void DrawPrimitivesExample(DrawingEngine drawingEngine, RectangleF area)
    {
        using (IDrawingBrush brush = drawingEngine.DrawingFactory.CreateSolidBrush(Color.LightGreen))
        using (IDrawingPen pen = drawingEngine.DrawingFactory.CreatePen(Color.Red, 2f))
        {
            // draw rectangle
            RectangleF figureRect = new RectangleF(area.X, area.Y, area.Width * 0.47f, area.Height * 0.47f);
            drawingEngine.FillRectangle(brush, figureRect);
            drawingEngine.DrawRectangle(pen, figureRect);
    
            // draw ellipse
            figureRect = new RectangleF(area.Width * 0.53f, area.Y, area.Width * 0.47f, area.Height * 0.47f);
            drawingEngine.FillEllipse(brush, figureRect);
            drawingEngine.DrawEllipse(pen, figureRect);
    
            // draw arc
            figureRect = new RectangleF(area.X, area.Height * 0.53f, area.Width * 0.47f, area.Height * 0.47f);
            drawingEngine.FillArc(brush, figureRect, 90, 140);
            drawingEngine.DrawArc(pen, figureRect, 90, 140);
    
            // draw pie
            drawingEngine.FillPie(brush, figureRect, -50, 50);
            drawingEngine.DrawPie(pen, figureRect, -50, 50);
    
            // create graphics path
            using (IGraphicsPath path = drawingEngine.DrawingFactory.CreateGraphicsPath())
            {
                // create curve points
                PointF startPoint = new PointF(area.Width * 0.53f, area.Height * 0.53f);
    
                PointF[] curvePoints = new PointF[]
                {
                    startPoint,
                    new PointF(startPoint.X * 1.3f, startPoint.Y * 1.8f),
                    new PointF(startPoint.X * 1.7f, startPoint.Y * 1.2f),
                    new PointF(area.Width * 0.99f, area.Height * 0.99f)
                };
    
                // add curve to path
                path.AddCurve(curvePoints, 0.5f);
                // draw path
                drawingEngine.FillPath(brush, path);
                drawingEngine.DrawPath(pen, path);
            }
        }
    }
    
    

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также