1

我在 c# 代码中使用 Path 绘制了一系列点。我只是在 xaml 中给出一个例子。

所以折线是从 (20,37) 到 (20,36) 并返回到 (20,37)。应该很短吧?但它变成了大约 9dp 长的片段。

如果我只是从 (20,37) 到 (20,36) 绘制,它表现正常。因为这些点是实时绘制的,所以我无法进行预处理。

为什么会这样以及如何解决?

<Path Stroke="Black" StrokeThickness="2">
    <Path.Data>
        <PathGeometry>
            <PathFigure StartPoint="20,37">
                <PathFigure.Segments>
                    <LineSegment Point="20,36"/>
                    <LineSegment Point="20,37"/>
                </PathFigure.Segments>
            </PathFigure>
        </PathGeometry>
    </Path.Data>
</Path>
4

1 回答 1

1

更改StrokeMiterLimitPath(默认为 10)

<Path Stroke="Black" StrokeThickness="2" StrokeMiterLimit="1">
于 2016-04-29T12:24:58.980 回答