1
我想在我的Polygon
中插入Image
,可能位于Polygon
的中心。可能吗?我能怎么做?将图像作为多边形内容插入
我想在我的Polygon
中插入Image
,可能位于Polygon
的中心。可能吗?我能怎么做?将图像作为多边形内容插入
您可以使用ImageBrush
作为多边形的Fill
。就像这样:
<Polygon.Fill>
<ImageBrush ImageSource="sampleImages\berries.jpg"
AlignmentX="..." AlignmentY="..." />
</Polygon.Fill>
可能是“点”属性帮助您:
<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>
谢谢,但我不想改变多边形填充。 – Nick
然后,您可以使用“PolygonGeometry”剪辑图像。参见[在WPF中裁剪或裁剪](http://www.c-sharpcorner.com/uploadfile/raj1979/cropping-or-clipping-in-wpf/)。有关集中的帮助,请参阅http://stackoverflow.com/questions/2208992/how-to-center-an-element-in-wpf-canvas –
您可以告诉我如何用示例剪辑图像? – Nick