简体   繁体   English

.net库使用GDI +绘制形状图像文本等

[英].net library to draw shapes images text etc, using GDI+

A stupid question here: 这是一个愚蠢的问题:

is there such a library to do these stuff? 有没有这样的图书馆来做这些东西? I want a more advanced library than system.drawing namespace. 我想要一个比system.drawing命名空间更高级的库。

You can look at Open Diagram at codeplex: 你可以在codeplex看看Open Diagram:

http://opendiagram.codeplex.com/ http://opendiagram.codeplex.com/

It's not GDI+, but have you considered using the System.Windows.Media.Imaging api (New since .Net 3.0). 这不是GDI +,但你考虑过使用System.Windows.Media.Imaging api(自.Net 3.0以来的新版本)。

It offers some better drawing abilities like the DrawGeometry(...) method. 它提供了一些更好的绘图功能,如DrawGeometry(...)方法。

First create a DrawingVisual and a DrawingContext : 首先创建一个DrawingVisual和一个DrawingContext

DrawingVisual visual = new DrawingVisual();
DrawingContext dc = visual.RenderOpen();

Then draw stuff on it: 然后在上面画东西:

dc.DrawRectangle(...);
dc.DrawText(...);
dc.DrawGeometry(...);
etc...

Make sure you close it: 确保你关闭它:

 dc.Close();

Once you have your visual object you can render it in WPF window or render it to a file. 获得可视对象后,可以在WPF窗口中呈现它或将其呈现为文件。 You can also use use a WPF Canvas as the visual object in the first place. 您也可以使用WPF Canvas作为可视对象。

There are some good MS Tutorials on Drawing Objects , Using DrawingVisual Objects and WPF Graphics Rendering . 有一些关于绘图对象的 MS教程, 使用DrawingVisual对象WPF图形渲染

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

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