更新:2007 年 11 月
命名空间:
System.Windows.Media 程序集:
PresentationCore(在 PresentationCore.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/xaml/presentation
Public NotInheritable Class ArcSegment _
Inherits PathSegment
Dim instance As ArcSegment
public sealed class ArcSegment : PathSegment
public ref class ArcSegment sealed : public PathSegment
public final class ArcSegment extends PathSegment
public final class ArcSegment extends PathSegment
使用 PathFigure 对象存储 ArcSegment 对象和其他线段。
一条椭圆弧由下列元素定义:它的起点和终点、X 轴半径和 Y 轴半径、X 轴旋转因子、一个指示弧是否应大于 180 度的值和一个描述弧的绘制方向的值。ArcSegment 类不包含弧的起点属性,它仅定义它所要表示的弧的目标点。弧的起点是 PathFigure(其中添加了 ArcSegment)的当前点。
下图演示不同的终点、Size 和 RotationAngle 设置。
.png)
.png)
.png)
IsLargeArc 和 SweepDirection
Freezable 功能
此示例演示如何绘制椭圆弧。若要创建椭圆弧,请使用 PathGeometry、PathFigure 和 ArcSegment 类。
在下面的示例中,椭圆弧是从 (10,100) 到 (200,100) 绘制而成的。该弧的 Size 为 100 x 50 个与设备无关的像素、RotationAngle 为 45 度、IsLargeArc 设置为 true、SweepDirection 为 Counterclockwise。
xaml在可扩展应用程序标记语言 (XAML) 中,可以使用属性语法来描述路径。
<Path Stroke="Black" StrokeThickness="1"
Data="M 10,100 A 100,50 45 1 0 200,100" />
xaml(请注意,此属性语法实际上创建一个 StreamGeometry(PathGeometry 的轻量版本)。有关更多信息,请参见路径标记语法页。)
在 XAML 中,还可以通过显式使用对象标记来绘制椭圆弧。下面的内容等效于前面的 XAML 标记。
<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>
此示例摘自一个更大的示例。有关完整示例,请参见几何图形示例。
System..::.Object
System.Windows.Threading..::.DispatcherObject
System.Windows..::.DependencyObject
System.Windows..::.Freezable
System.Windows.Media.Animation..::.Animatable
System.Windows.Media..::.PathSegment
System.Windows.Media..::.ArcSegment
此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
.NET Framework
受以下版本支持:3.5、3.0
参考
其他资源