WPF:如何制作绘图应用程序? [英] WPF: How to make a Drawing Application?
问题描述
我想制作一个像应用程序(铅笔,文字,橡皮擦,线条和形状图纸)的 Paint ,能够调整形状和尺寸。在 WPF
中随时编辑文本(如Microsoft PowerPoint)。
我的问题是
:我应该使用什么工具? (由于某些原因我不想使用Inkcanvas)
以及如何制作我自己的自定义绘图笔(例如使用Image for that)或只是一个柔软的边缘画笔?
对不起我问了很多,但我能够在winForm应用程序中完成所有操作。
Hi, I want to make a Paint like App(pencil, text, eraser, lines & shapes drawings) with ability to resize shapes & edit Text at any time (Like Microsoft PowerPoint) in WPF
.
My Question is
: What Tools should I use? (for some reasons I don''t want to use Inkcanvas)
And how to make my own custom drawing brush (for example using an Image for that) or just a soft edge brush?
Sorry I am asking a lot, but I was able to do all that in winForm Applications.
<Thanks To="All" Regards="Best"></Thanks>
推荐答案
这是非常可行的,但是,在我看来,不幸的是,即使最初的方向和想法也会花费太多的工作。
所以,粗略地说,对于像素图形,你可以使用DrawingVisual
和,对于vector -Canvas
。您可以结合不同的方法并做许多不同的事情。请参阅:
http://msdn.microsoft.com/en-us /library/ms742254.aspx [ ^ ],
http://msdn.microsoft.com/en -us / library / ms753209.aspx [ ^ ];
http:/ /msdn.microsoft.com/en-us/library/system.windows.controls.canvas.aspx [ ^ ],
http://wpftutorial.net/Canvas.html [ ^ ]。
WPF文档相当不错;您可以自己找到所需的一切,只需花一些时间。你的时间:-)。
-SA
This is quite doable, but, in my view, unfortunately, even the initial directions and ideas would take too much work.
So, roughly speaking, for pixel graphics, you can useDrawingVisual
and, for vector —Canvas
. You can combine different approaches and do many different things. Please see:
http://msdn.microsoft.com/en-us/library/ms742254.aspx[^],
http://msdn.microsoft.com/en-us/library/ms753209.aspx[^];
http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas.aspx[^],
http://wpftutorial.net/Canvas.html[^].
WPF documentation is pretty good; you can find all you need by yourself, just spend some time. Your time :-).
—SA
这在WPF中实际上比较难,因为这样做的逻辑方法不是绘制位图,而是跟踪动作并将它们绘制在图像的顶部。至少,这就是我做这件事时的表现,这是一种皇家的痛苦
This is actually harder in WPF, because the logical way to do it, is not to draw on a bitmap, but to keep track of actions and draw them on TOP of your image. At least, that''s how I did it when I did it and it was a royal pain
这篇关于WPF:如何制作绘图应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!