高性能积控制在WPF高性能、WPF

2023-09-04 03:07:06 作者:Distractions.  分心 -

我做了一些工作,我需要制定一个控制,它应该是一个简单的图,显示了几个点和两条边。

I am doing some work for which I need to develop a control, it should be a simple graph that shows several points and two edges.

我的问题是,我需要显示多达16K点,以30赫兹的更新率。有没有人做过类似的事情?和有什么建议?

My problem is that I need to show up to 16k points, with an update rate of 30 Hz. Has anyone done something similar?, and has any advice?.

例如是否自FrameworkElement或控制(ItemsControl的在这种情况下)继承。如果从FrameworkElememt控制继承它可能有更好的表现在的OnRender方法绘制点,但我会怀念这里的模板特性来自从Control继承。

For example whether to inherit from FrameworkElement or Control (ItemsControl in this case). If the control inherits from FrameworkElememt it may have a better performance drawing the points in the OnRender method but I would miss the Templating feature that comes from inheriting from Control.

抑或存在其它控制,可以做到这一点呢?

Or does there exist another control that can do this out there?

在此先感谢您的时间。

推荐答案

我结束了使用InteropBitmap,它是WPF的fatest位图呈现类。

I ended up using InteropBitmap, it is the fatest bitmap rendering class from WPF.

它可以让你映射你要画(在内存中),然后REDER它作为一个图像的图像。这是完美的,因为我需要绘制在屏幕上的点。

It allows you to map the image that you want to paint (in memory) and then reder it as a Image. This was perfect as i needed to plot points on the screen.

我得到了很大的性能(差不多50赫兹为20K点),我也用PLINQ在内存升级点。

I got great performance (almost 50Hz for 20k points), i also use PLINQ to update the points in memory.

查看更多详情这文章。 ..

check this article for more details...