【问题标题】:How to insert an image in wpf path?如何在 wpf 路径中插入图像?
【发布时间】:2015-04-07 11:18:17
【问题描述】:

您好,我使用以下代码在 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>

它工作正常。现在我需要的是在路径之间有一个图像。这样图像就会位于曲线的中心。你能帮忙看看怎么做吗?

【问题讨论】:

    标签: wpf path


    【解决方案1】:

    你可以试试填充属性

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      相关资源
      最近更新 更多