Export (0) Print
Expand All

StreamGeometryContext.ArcTo Method

Draws an arc to the specified point.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)

public abstract void ArcTo (
	Point point,
	Size size,
	double rotationAngle,
	bool isLargeArc,
	SweepDirection sweepDirection,
	bool isStroked,
	bool isSmoothJoin
)
public abstract void ArcTo (
	Point point, 
	Size size, 
	double rotationAngle, 
	boolean isLargeArc, 
	SweepDirection sweepDirection, 
	boolean isStroked, 
	boolean isSmoothJoin
)
public abstract function ArcTo (
	point : Point, 
	size : Size, 
	rotationAngle : double, 
	isLargeArc : boolean, 
	sweepDirection : SweepDirection, 
	isStroked : boolean, 
	isSmoothJoin : boolean
)
You cannot use methods in XAML.

Parameters

point

The destination point for the end of the arc.

size

The width and height of an oval whose perimeter is used to draw the angle. If the oval is very rounded in all directions, the arc will be rounded, if it is nearly flat, so will the arc. For example, a very large width and height would represent a very large oval, which would give a slight curvature for the angle.

rotationAngle

The rotation angle of the oval that specifies the curve. The curvature of the arc can be rotated with this parameter.

isLargeArc

true to draw the arc greater than 180 degrees; otherwise, false.

sweepDirection

A value that indicates whether the arc is drawn in the Clockwise or Counterclockwise direction.

isStroked

true to make the segment stroked when a Pen is used to render the segment; otherwise, false.

isSmoothJoin

true to treat the join between this segment and the previous segment as a corner when stroked with a Pen; otherwise, false.

This method uses the end point of the previous segment as its starting point. If this is the first segment in a figure, it uses the point specified by the BeginFigure method as its start point.

A StreamGeometry cannot be serialized if it contains a Transform or any non-stroked or unfilled segments.

The following example shows how to draw an arc using the ArcTo method.

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

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft