private void CreateBezierSegment()
{
PathFigure pthFigure = new PathFigure();
pthFigure.StartPoint = new Point(10, 100);
System.Windows.Point Point1 = new System.Windows.Point(100, 0);
System.Windows.Point Point2 = new System.Windows.Point(200, 200);
System.Windows.Point Point3 = new System.Windows.Point(300, 100);
BezierSegment bzSeg = new BezierSegment();
bzSeg.Point1 = Point1;
bzSeg.Point2 = Point2;
bzSeg.Point3 = Point3;
PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
myPathSegmentCollection.Add(bzSeg);
pthFigure.Segments = myPathSegmentCollection;
PathFigureCollection pthFigureCollection = new PathFigureCollection();
pthFigureCollection.Add(pthFigure);
PathGeometry pthGeometry = new PathGeometry();
pthGeometry.Figures = pthFigureCollection;
Path arcPath = new Path();
arcPath.Stroke = new SolidColorBrush(Colors.Black);
arcPath.StrokeThickness = 1;
arcPath.Data = pthGeometry;
arcPath.Fill = new SolidColorBrush(Colors.Yellow);
LayoutRoot.Children.Add(arcPath);
} |