如何画一个带有x标记的圆?

How to draw a circle with x mark?

我正在尝试用完美的 X 标记画一个圆。 我设法用一半的 X 标记画了一个圆圈。不知道下半场怎么画

谢谢

 <Path Stroke="Black"
          StrokeThickness="4" Fill="Red" VerticalAlignment="Center" HorizontalAlignment="Center">
        <Path.Data>
            <PathGeometry>
                <PathGeometry.Figures>
                    <PathFigure StartPoint="0,0">
                        <PathFigure.Segments>
                          <LineSegment Point="100,100" />
                            <ArcSegment Size="50,50"
                                        RotationAngle="45"
                                        IsLargeArc="True"
                                        SweepDirection="Clockwise"
                                        Point="0,0" />
                            <ArcSegment Size="50,50"
                                        RotationAngle="45"
                                        IsLargeArc="True"
                                        SweepDirection="Clockwise"
                                        Point="100,100" />
                        </PathFigure.Segments>
                    </PathFigure>
                </PathGeometry.Figures>
            </PathGeometry>
        </Path.Data>
    </Path>

你可以 "simplify" 这个,或者至少让它在 XAML 编辑器中占用更少 space,using Path Markup Syntax。空行之前的 Data 部分重现了您已经得到的内容:M 代表 "move",L 代表 "line to",A 代表"arc"。 “Move”和“Line To”命令在空白行之后添加第二行。

<Path
    Stroke="Black"
    StrokeThickness="4"
    Fill="Red"
    Data="
        M 0,0 
        L 100,100
        A 50,50 45 1 1 0,0 
        A 50,50 45 1 1 100,100 

        M 100,0 
        L 0,100"
    />

你不需要像那样用换行符来格式化它;我刚刚插入换行符以阐明它如何映射到您的版本。幸运的是,您将属性添加到 ArcSegment 元素的顺序与标记语法中 A 的相应参数相同。

这是通常的做法,尽管可以说它的可读性较差:

Data="M 0,0 L 100,100 A 50,50 45 1 1 0,0 A 50,50 45 1 1 100,100 M 100,0 L 0,100" 

或者,要以与开始相同的方式完成它,只需将第二行添加为另一行 PathFigure:

<Path 
    Stroke="Black"
    StrokeThickness="4" 
    Fill="Red" 
    VerticalAlignment="Center" 
    HorizontalAlignment="Center">
    <Path.Data>
        <PathGeometry>
            <PathGeometry.Figures>
                <PathFigure StartPoint="0,0">
                    <PathFigure.Segments>
                        <LineSegment Point="100,100" />
                        <ArcSegment 
                            Size="50,50"
                            RotationAngle="45"
                            IsLargeArc="True"
                            SweepDirection="Clockwise"
                            Point="0,0" 
                            />
                        <ArcSegment 
                            Size="50,50"
                            RotationAngle="45"
                            IsLargeArc="True"
                            SweepDirection="Clockwise"
                            Point="100,100" 
                            />
                    </PathFigure.Segments>
                </PathFigure>

                <!-- Second line -->
                <PathFigure StartPoint="100,0">
                    <PathFigure.Segments>
                        <LineSegment Point="0,100" />
                    </PathFigure.Segments>
                </PathFigure>
                <!-- /Second line -->

            </PathGeometry.Figures>
        </PathGeometry>
    </Path.Data>
</Path>

使用这个...https://materialdesignicons.com/

<Viewbox Width="48" Height="48">
<Canvas Width="24" Height="24">
    <Path Data="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2C6.47,2 2,6.47 2,12C2,17.53 6.47,22 12,22C17.53,22 22,17.53 22,12C22,6.47 17.53,2 12,2M14.59,8L12,10.59L9.41,8L8,9.41L10.59,12L8,14.59L9.41,16L12,13.41L14.59,16L16,14.59L13.41,12L16,9.41L14.59,8Z" Fill="Black" />
</Canvas>