如何在wpf路径中插入图像



Hi i使用以下代码在WPF中创建路径。

        <Path Stroke="White" StrokeThickness="1" Stretch="Fill">
            <Path.Data>
                <PathGeometry>
                    <PathGeometry.Figures>
                        <PathFigureCollection>
                            <PathFigure StartPoint="0,0">
                                <PathFigure.Segments>
                                    <PathSegmentCollection>
                                        <QuadraticBezierSegment Point1="200,200" Point2="0,400" />
                                    </PathSegmentCollection>
                                </PathFigure.Segments>
                            </PathFigure>
                        </PathFigureCollection>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>

它运行良好。现在我需要的是在路径之间有一个图像。这样图像就会位于曲线的中心。你能帮我怎么做吗?

您可以尝试填充属性

<Path Stroke="Black" StrokeThickness="1" Stretch="Fill">
    <Path.Data>
    ...
    ...
    ...
    </Path.Data>
    <Path.Fill>
        <ImageBrush ImageSource="C:Image.jpg"/>
    </Path.Fill>
</Path>

最新更新