我试图以编程方式在XAML Canvas上绘制一条包含大量断开线段的路径
Path path = new Path();
path.Stroke = new SolidColorBrush(Windows.UI.Colors.White);
path.StrokeThickness = 2.0;
GeometryGroup geomGroup = new GeometryGroup();
for (int i = 0; i < Samples.Count; ++i)
{
double f = Samples[i];
Point a = new Point(i * dpixels, y_c - f * y_c);
Point b = new Point(i * dpixels, y_c + f * y_c);
LineGeometry line = new LineGeometry();
line.StartPoint = a;
line.EndPoint = b;
geomGroup.Children.Add(line);
}
path.Data = geomGroup;
canvas.Children.Add(path);
问题是当GeometryGroup中的LineGeometry对象太多时,线条会变得模糊。这很混乱,因为它似乎完全取决于行数。如果我添加完全相同的线,但更少,它们不再模糊。这里发生了什么,我该如何解决?
谢谢!
大卫