可以画一个Shape http://msdn.microsoft.com/en-us/library/system.windows.shapes(v=VS.95).aspx其背景是由斜线构成的?
一个例子Rectangle
(抱歉图像质量):
如果我想要虚线或更改线条属性(笔画、粗细..)?
您可以使用本文中的解决方案http://mark-dot-net.blogspot.com/2007/06/creating-hatched-patterned-brush-in-wpf.html http://mark-dot-net.blogspot.com/2007/06/creating-hatched-patterned-brush-in-wpf.html
<VisualBrush
x:Key="HatchBrush"
TileMode="Tile" Viewport="0,0,10,10"
ViewportUnits="Absolute" Viewbox="0,0,10,10"
ViewboxUnits="Absolute">
<VisualBrush.Visual>
<Canvas>
<Rectangle Fill="Azure" Width="10" Height="10" />
<Path Stroke="Purple" Data="M 0 0 l 10 10" />
</Canvas>
</VisualBrush.Visual>
</VisualBrush>
只需更改参数等即可适合您的应用
Usage:
<Rectangle Width="80" Height="40"
Fill="{StaticResource HatchBrush}"/>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)