weird issue when drawing a forth and back path in

2019-06-14 09:31发布

I was drawing a series of points with Path in c# code. I just give an example in xaml.

So the polyline is from (20,37) to (20,36) and returns to (20,37). It is supposed to be very short, right? But it turns to be a segment roughly 9dp long.

if I simply draw from (20,37) to (20,36), it behaves normal. Because the points are drawn in real-time that I cannot do preprocessing.

Why is that and how to solve it?

<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>

1条回答
smile是对你的礼貌
2楼-- · 2019-06-14 10:19

change StrokeMiterLimit of Path (default is 10)

<Path Stroke="Black" StrokeThickness="2" StrokeMiterLimit="1">
查看更多
登录 后发表回答