Como: Criar uma curva cúbica de Bézier
This example shows how to create a cubic Bezier curve. To create a cubic Bezier curve, use the PathGeometry, PathFigure, and BezierSegment classes. To display the resulting geometry, use a Path element, or use it with a GeometryDrawing or a DrawingContext. In the following examples, a cubic Bezier curve is drawn from (10, 100) to (300, 100). The curve has control points of (100, 0) and (200, 200).
Exemplo
[xaml]
In Extensible Application Markup Language (XAML), you may use abbreviated markup syntax to describe a path.
<Path Stroke="Black" StrokeThickness="1"
Data="M 10,100 C 100,0 200,200 300,100" />
[xaml]
In XAML, you can also draw a cubic Bezier curve using object tags. A seguir é equivalente à anterior XAML exemplo.
<Path Stroke="Black" StrokeThickness="1">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="10,100">
<PathFigure.Segments>
<PathSegmentCollection>
<BezierSegment Point1="100,0" Point2="200,200" Point3="300,100" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
Este exemplo é parte de uma amostra maior; Para obter o exemplo completo, consulte o A amostra de geometrias.
Consulte também
Tarefas
Como: Criar um LineSegment em um PathGeometry