简体   繁体   English

我应该使用哪种控件进行WPF的2D绘图?

[英]Which control should I use for 2D drawing with WPF?

I want to programatically draw a few simple 2D shapes in a WPF application. 我想以编程方式在WPF应用程序中绘制一些简单的2D形状。 Which control should I use for that? 我应该使用哪种控件? I've heard that Canvas can do that but that it's mostly designed to be a container for other controls and not a "drawing" canvas. 我听说Canvas可以做到这一点,但它主要是为了其他控件的容器,而不是“绘图”画布。

Those other controls could be shapes like rectangles, lines, etc., so Canvas may be a good start. 那些其他控件可以是矩形,线条等形状,因此Canvas可能是一个好的开始。 If you want to render directly through a function, you could basically use any (user)control as base class, though. 如果你想直接通过一个函数进行渲染,你基本上可以使用任何(用户)控件作为基类。

Canvas is meant for drawing, obviously. 显然,Canvas用于绘图。 What is your concern ? 你关心的是什么? if it is Speed, you should have a look on Windows XNA. 如果是Speed,你应该看看Windows XNA。
Maybe Direct X, Open GL or any library providing access to them could be of some use. 也许Direct X,Open GL或任何提供访问它们的库都可能有用。 Give more details on your needs for an answer. 提供有关您的答案需求的更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM