-1

我有这个代码:

<Path Fill="Brown">
  <Path.Data>
    <RectangleGeometry x:Name="rec"
                       RadiusX="0"
                       RadiusY="20"
                       Rect="410,135,60,25"></RectangleGeometry>
  </Path.Data>
</Path>

我怎样才能Image为此设置背景Rectangle

4

1 回答 1

1

您可以使用ImageBrush路径的Fill属性:

<Path>
    <Path.Fill>
        <ImageBrush ImageSource="..."/>
    </Path.Fill>
    <Path.Data>
        <RectangleGeometry x:Name="rec" RadiusX="0" RadiusY="20" Rect="410,135,60,25"></RectangleGeometry>
    </Path.Data>
</Path>
于 2013-05-19T19:42:07.643 回答