我正在编写WPF代码来显示一个实时图,它是一条包含大约 10,000 个点的连接线。在我的电脑中显示一张图片大约需要 5 秒钟。有没有人想在 0.5 秒内让它更快?
class eee : FrameworkElement
{
public eee()
{
_children = new VisualCollection(this);
Random rand = new Random();
DrawingVisual dv = new DrawingVisual();
using (DrawingContext dx = dv.RenderOpen())
{
Pen drawingPen = new Pen(Brushes.Black, 1);
double x=rand.Next(300);
double y = rand.Next(300);
for (double i = 0; i < 1000; i = i + 0.1)
{
y = 100 + rand.Next(100);
dx.DrawLine(drawingPen, new Point(i, x), new Point(i + 1, y));
x = y;
}
}
_children.Add(dv);
}