Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
ArcSegment Class
 SweepDirection Property

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
ArcSegment..::.SweepDirection Property

Gets or sets a value that specifies whether the arc is drawn in the Clockwise or Counterclockwise direction. This is a dependency property.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/xaml/presentation
Visual Basic (Declaration)
Public Property SweepDirection As SweepDirection
Visual Basic (Usage)
Dim instance As ArcSegment
Dim value As SweepDirection

value = instance.SweepDirection

instance.SweepDirection = value
C#
public SweepDirection SweepDirection { get; set; }
Visual C++
public:
property SweepDirection SweepDirection {
    SweepDirection get ();
    void set (SweepDirection value);
}
JScript
public function get SweepDirection () : SweepDirection
public function set SweepDirection (value : SweepDirection)
XAML Attribute Usage
<object SweepDirection="SweepDirection" .../>

Property Value

Type: System.Windows.Media..::.SweepDirection
A value that specifies the direction in which the arc is drawn. The default value is Counterclockwise.

Identifier field

SweepDirectionProperty

Metadata properties set to true

None

For an ArcSegment with a given Size, RotationAngle, start point, and end Point, four different arcs are possible. Specifying the IsLargeArc property reduces the number of possible arcs to two: an arc drawn from the start point to the end Point in a Clockwise direction and an arc drawn from the start point to the end point in a Counterclockwise direction.

The following illustration shows two elliptical arcs that are identical except for their SweepDirection settings.

ArcSegment objects with different SweepDirection settings

ArcSegments with different SweepDirection settings

This example shows how to draw an elliptical arc. To create an elliptical arc, use the PathGeometry, PathFigure, and ArcSegment classes.

In the following examples, an elliptical arc is drawn from (10,100) to (200,100). The arc has a Size of 100 by 50 device-independent pixels, a RotationAngle of 45 degrees, an IsLargeArc setting of true, and a SweepDirection of Counterclockwise.

xaml

In Extensible Application Markup Language (XAML), you can use attribute syntax to describe a path.

<Path Stroke="Black" StrokeThickness="1"  
  Data="M 10,100 A 100,50 45 1 0 200,100" />

xaml

(Note that this attribute syntax actually creates a StreamGeometry, a lighter-weight version of a PathGeometry. For more information, see the Path Markup Syntax page.)

In XAML, you can also draw an elliptical arc by explicitly using object tags. The following is equivalent to the preceding XAML markup.

<Path Stroke="Black" StrokeThickness="1">
  <Path.Data>
    <PathGeometry>
      <PathGeometry.Figures>
        <PathFigureCollection>
          <PathFigure StartPoint="10,100">
            <PathFigure.Segments>
              <PathSegmentCollection>
                <ArcSegment Size="100,50" RotationAngle="45" IsLargeArc="True" SweepDirection="CounterClockwise" Point="200,100" />
              </PathSegmentCollection>
            </PathFigure.Segments>
          </PathFigure>
        </PathFigureCollection>
      </PathGeometry.Figures>
    </PathGeometry>
  </Path.Data>
</Path>

This example is part of a larger sample. For the complete sample, see the Geometries Sample.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Community Content   What is Community Content?
Add new content RSS  Annotations
second image example is wrong      pfongkye   |   Edit   |   Show History
I think that the SweepDirection of the second image example is Counterclockwise rather than Clockwise
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker