8,734
社区成员
发帖
与我相关
我的任务
分享
Path path = new Path();
Point startPoint=new Point(100,100);
PathFigure pf = DrawWave(10,100d,80,120,startPoint);
PathGeometry pg = new PathGeometry();
pg.Figures.Add(pf);
path.Data = pg;
path.Stroke = new SolidColorBrush(Colors.Black);
//波浪线画法函数,我的波浪线是由很多的“波”,组成的
PathFigure DrawWave(int sum,double waveWith,double xRadius,double yRadius,Point startPoint)
{
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = startPoint;
for (int i = 0; i < sum; i++)
{
ArcSegment arcSegment = new ArcSegment();
arcSegment.Point = new Point(startPoint.X + waveWith*i, startPoint.Y);
arcSegment.Size = new Size(xRadius, yRadius);
pathFigure.Segments.Add(arcSegment);
}
return pathFigure;
}