weird issue when drawing a forth and back path in wpf

萝らか妹 提交于 2019-12-08 12:18:51

问题


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:


change StrokeMiterLimit of Path (default is 10)

<Path Stroke="Black" StrokeThickness="2" StrokeMiterLimit="1">


来源:https://stackoverflow.com/questions/36937409/weird-issue-when-drawing-a-forth-and-back-path-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!