3

我正在使用 XAML 设计一个 Metro Style 应用程序,并且我需要画一个圆圈,使末端没有正确地相遇,就好像它是用红毡笔潦草地写的一样。像这样的东西:

在此处输入图像描述

这怎么能在 XAML 中完成?

4

2 回答 2

3

好的,准备一点 XAML:

<Path Grid.Row="1" Grid.Column="1" Margin="10"              
        Stroke="Red" StrokeThickness="5">
    <Path.Data>
        <PathGeometry>
            <PathGeometry.Figures>
                <PathFigureCollection>
                    <PathFigure IsClosed="False" StartPoint="5,50">
                        <PathFigure.Segments>
                            <PathSegmentCollection>

                                <ArcSegment Point="50,5" Size="80, 40" SweepDirection="Clockwise" />
                                <ArcSegment Point="95,50" Size="50, 50" SweepDirection="Clockwise" />
                                <ArcSegment Point="50,95" Size="50, 50" SweepDirection="Clockwise" />
                                <ArcSegment Point="5,55" Size="55, 100" SweepDirection="Clockwise" />

                            </PathSegmentCollection>
                        </PathFigure.Segments>
                    </PathFigure>
                </PathFigureCollection>
            </PathGeometry.Figures>
        </PathGeometry>
    </Path.Data>
</Path>

此代码产生:

在此处输入图像描述

您可以稍微调整坐标以获得更| 更圆的结果,并且可能使用 BezierSegments。

于 2012-08-28T12:16:59.620 回答
1

您可以使用XAML 中的可用形状绘制一个没有轮廓的封闭形状,用红色填充。特别是,您可以将形状轮廓基于BezierSegment

于 2012-08-28T11:47:03.513 回答