Share via


StreamGeometryContext.ArcTo Metodo

Definizione

Disegna un arco nel punto specificato.

public:
 abstract void ArcTo(System::Windows::Point point, System::Windows::Size size, double rotationAngle, bool isLargeArc, System::Windows::Media::SweepDirection sweepDirection, bool isStroked, bool isSmoothJoin);
public abstract void ArcTo (System.Windows.Point point, System.Windows.Size size, double rotationAngle, bool isLargeArc, System.Windows.Media.SweepDirection sweepDirection, bool isStroked, bool isSmoothJoin);
abstract member ArcTo : System.Windows.Point * System.Windows.Size * double * bool * System.Windows.Media.SweepDirection * bool * bool -> unit
Public MustOverride Sub ArcTo (point As Point, size As Size, rotationAngle As Double, isLargeArc As Boolean, sweepDirection As SweepDirection, isStroked As Boolean, isSmoothJoin As Boolean)

Parametri

point
Point

Punto di destinazione per la fine dell'arco.

size
Size

Raggi (metà larghezza e metà altezza) di un ovale il cui perimetro viene utilizzato per disegnare l'angolo. Se l'ovale è molto arrotondato in tutte le direzioni, l'arco verrà arrotondato, se è quasi piatto, quindi l'arco. Ad esempio, una larghezza e un'altezza molto grandi rappresentano un ovale molto grande, che darebbe una leggera curvatura per l'angolo.

rotationAngle
Double

Angolo di rotazione della forma ovale che specifica la curva. La curvatura dell'arco può essere ruotata con questo parametro.

isLargeArc
Boolean

true per disegnare un arco maggiore di 180 gradi, altrimenti false.

sweepDirection
SweepDirection

Valore che indica se l'arco viene disegnato in direzione Clockwise o Counterclockwise.

isStroked
Boolean

true per tracciare il segmento quando si utilizza un oggetto Pen per eseguire il rendering del segmento, altrimenti false.

isSmoothJoin
Boolean

true per trattare come un angolo il join tra questo segmento e quello precedente tracciato con un oggetto Pen, altrimenti false.

Esempio

Nell'esempio seguente viene illustrato come disegnare un arco usando il ArcTo metodo .

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace SDKSample
{
    public partial class StreamGeometryArcToExample : Page
    {
        public StreamGeometryArcToExample()
        {
            // Create a path to draw a geometry with.
            Path myPath = new Path();
            myPath.Stroke = Brushes.Black;
            myPath.StrokeThickness = 1;

            // Create a StreamGeometry to use to specify myPath.
            StreamGeometry geometry = new StreamGeometry();
            geometry.FillRule = FillRule.EvenOdd;

            // Open a StreamGeometryContext that can be used to describe this StreamGeometry object's contents. 
            using (StreamGeometryContext ctx = geometry.Open())
            {
                // Set the begin point of the shape.
                ctx.BeginFigure(new Point(10, 100), true /* is filled */, false /* is closed */);

                // Create an arc. Draw the arc from the begin point to 200,100 with the specified parameters.
                ctx.ArcTo(new Point(200, 100), new Size(100, 50), 45 /* rotation angle */, true /* is large arc */, 
                          SweepDirection.Counterclockwise, true /* is stroked */, false /* is smooth join */);
            }

            // Freeze the geometry (make it unmodifiable)
            // for additional performance benefits.
            geometry.Freeze();
            
            // specify the shape (arc) of the path using the StreamGeometry.
            myPath.Data = geometry;

            // Add path shape to the UI.
            StackPanel mainPanel = new StackPanel();
            mainPanel.Children.Add(myPath);
            this.Content = mainPanel;
        }
    }
}

Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Shapes

Namespace SDKSample
    Partial Public Class StreamGeometryArcToExample
        Inherits Page
        Public Sub New()
            ' Create a path to draw a geometry with.
            Dim myPath As New Path()
            myPath.Stroke = Brushes.Black
            myPath.StrokeThickness = 1

            ' Create a StreamGeometry to use to specify myPath.
            Dim geometry As New StreamGeometry()
            geometry.FillRule = FillRule.EvenOdd

            ' Open a StreamGeometryContext that can be used to describe this StreamGeometry object's contents. 
            Using ctx As StreamGeometryContext = geometry.Open()
                ' Set the begin point of the shape.
                ctx.BeginFigure(New Point(10, 100), True, False) ' is closed  -  is filled 

                ' Create an arc. Draw the arc from the begin point to 200,100 with the specified parameters.
                ctx.ArcTo(New Point(200, 100), New Size(100, 50), 45, True, SweepDirection.Counterclockwise, True, False) ' is smooth join  -  is stroked  -  is large arc  -  rotation angle 

            End Using

            ' Freeze the geometry (make it unmodifiable)
            ' for additional performance benefits.
            geometry.Freeze()

            ' specify the shape (arc) of the path using the StreamGeometry.
            myPath.Data = geometry

            ' Add path shape to the UI.
            Dim mainPanel As New StackPanel()
            mainPanel.Children.Add(myPath)
            Me.Content = mainPanel
        End Sub
    End Class
End Namespace

Commenti

Questo metodo usa il punto finale del segmento precedente come punto iniziale. Se si tratta del primo segmento di una figura, usa il punto specificato dal BeginFigure metodo come punto iniziale.

Un StreamGeometry oggetto non può essere serializzato se contiene un oggetto o segmenti Transform non tracciati o non riempiti.

Si applica a

Vedi anche