我有一条曲线/线网格。我想用不同的颜色填充线之间的每个空间。 这是我绘制网格的代码。
private void DrawBezierGrid()
{
List<Point> startPoints = new List<Point>();
List<Point> controlPoints1 = new List<Point>();
List<Point> controlPoints2 = new List<Point>();
List<Point> endPoints = new List<Point>();
List<Path> paths = new List<Path>();
List<Line> lines = new List<Line>();
for (int i = 0; i < 10; i++)
{
startPoints.Add(new Point(i * 40, 0));
controlPoints1.Add(new Point(i * 40, 200));
controlPoints2.Add(new Point(100 + (i * 40), 200));
endPoints.Add(new Point(100 + (i * 40), 400));
}
for (int i = 0; i < 10; i++)
{
Path path = new Path();
path.Stroke = new SolidColorBrush(Colors.Blue);
path.StrokeThickness = 1;
PathGeometry path_geometry = new PathGeometry();
path.Data = path_geometry;
PathFigure path_figure = new PathFigure();
path_geometry.Figures.Add(path_figure);
path_figure.StartPoint = startPoints[i];
PathSegmentCollection path_segment_collection = new PathSegmentCollection();
path_figure.Segments = path_segment_collection;
BezierSegment bezier_segment = new BezierSegment();
bezier_segment.Point1 = controlPoints1[i];
bezier_segment.Point2 = controlPoints2[i];
bezier_segment.Point3 = endPoints[i];
path_segment_collection.Add(bezier_segment);
canvas.Children.Add(path);
paths.Add(path);
}
for (int i = 0; i < 11; i++)
{
Line line = new Line();
line.Stroke = new SolidColorBrush(Colors.Black);
line.StrokeThickness = 1;
line.X1 = 0;
line.X2 = 400;
line.Y1 = i * 40;
line.Y2 = i * 40;
canvas.Children.Add(line);
lines.Add(line);
}
}
我想从线列表中选择2条相邻线,从路径列表中选择2条相邻曲线,然后填充这4条曲线/线之间的区域
我该怎么做?