wpf WPF中的几何图形绘制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22589778/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Geometry drawing in WPF
提问by user1531186
I'm kinda new to all this geometry part, but I can see it gives me the ability to draw basically whatever I want. I can't find a good manual that teaches how to create whatever image I have in my head. I really hoped to find some kinda painter that extracts the data of the geometry for me but no luck so far.
我对所有这些几何部分都很陌生,但我可以看到它使我能够基本上绘制我想要的任何东西。我找不到一本好的手册来教我如何创建我脑海中的任何图像。我真的希望找到一些能帮我提取几何数据的画家,但到目前为止还没有运气。
For example, I found this online:
例如,我在网上找到了这个:
<Geometry x:Key="MagnifierIconGeometry">M44,12 C32,12 22,22 22,34 22,46 32,56 44,56 56,56 66,46 66,34 66,22 56,12 44,12z M44,0 C63,0 78,15 78,34 78,53 63,68 44,68 40,68 36.5,67.5 33,66 L32.5,66 14,90 0,79.5 18,55.5 17,55 C13,49 10,42 10,34 10,15 25,0 44,0z</Geometry>
You can tell by the name what it draws, but I would like to know how to do it myself?
看名字就知道画的是什么,但我想知道自己怎么做?
If anyone could point me to a manual/any kind of program that would be fantastic!
如果有人能指出我的手册/任何类型的程序,那就太棒了!
Thanks.
谢谢。
回答by Anatoliy Nikolaev
To display vector graphics, in this case you can use the Pathlike this:
要显示矢量图形,在这种情况下,您可以Path像这样使用:
<Window.Resources>
<Geometry x:Key="MagnifierIconGeometry">M44,12 C32,12 22,22 22,34 22,46 32,56 44,56 56,56 66,46 66,34 66,22 56,12 44,12z M44,0 C63,0 78,15 78,34 78,53 63,68 44,68 40,68 36.5,67.5 33,66 L32.5,66 14,90 0,79.5 18,55.5 17,55 C13,49 10,42 10,34 10,15 25,0 44,0z</Geometry>
</Window.Resources>
<Grid>
<Path Data="{StaticResource MagnifierIconGeometry}"
Width="30"
Height="30"
Fill="Aqua"
Stretch="Fill" />
</Grid>
Output
Output


More info
更多信息
For more information you can see this:
有关更多信息,您可以查看以下内容:
MSDN: Shapes and Basic Drawing in WPF Overview
MSDN: Shapes and Basic Drawing in WPF Overview
Charles Petzold: Vector Graphics and the WPF Shape Class
Charles Petzold: Vector Graphics and the WPF Shape Class
Source of vector images
矢量图像的来源
The www.modernuiicons.comcontains a huge amount of vector images that you can use in your applications.
该www.modernuiicons.com蕴含着巨大的,你可以在你的应用程序中使用矢量图像的数量。
Program for working with vector images
用于处理矢量图像的程序
To work with vector graphics you can use Microsoft Expression Blend:
要使用矢量图形,您可以使用Microsoft Expression Blend:

