【发布时间】:2012-06-26 10:13:35
【问题描述】:
我想在我的Polygon 中插入一个Image,可能在Polygon 的中心。是否可以?我该怎么办?
【问题讨论】:
我想在我的Polygon 中插入一个Image,可能在Polygon 的中心。是否可以?我该怎么办?
【问题讨论】:
您可以使用ImageBrush 作为多边形的Fill。像这样:
<Polygon.Fill>
<ImageBrush ImageSource="sampleImages\berries.jpg"
AlignmentX="..." AlignmentY="..." />
</Polygon.Fill>
【讨论】:
PolygonGeometry 剪辑图像。见Cropping or Clipping in WPF。有关居中的帮助,请参阅stackoverflow.com/questions/2208992/…
可能是“点”属性帮助你:
<Polygon Points="40,0 150,100 10,100" >
<Polygon.Fill>
<ImageBrush ImageSource="C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg" Stretch="Uniform" AlignmentX="Left" />
</Polygon.Fill>
</Polygon>
【讨论】: