在wpf中绘制来回路径时出现奇怪的问题 [英] weird issue when drawing a forth and back path in wpf
本文介绍了在wpf中绘制来回路径时出现奇怪的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在c#代码中使用Path绘制了一系列点.我只是以xaml为例.
I was drawing a series of points with Path in c# code. I just give an example in xaml.
因此折线从(20,37)到(20,36),然后返回(20,37).应该很短吧?但这变成了大约9dp长的一段.
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.
如果我简单地从(20,37)画到(20,36),它的行为正常.因为这些点是实时绘制的,所以我无法进行预处理.
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.
为什么?如何解决?
<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>
推荐答案
change StrokeMiterLimit of Path
(default is 10)
<Path Stroke="Black" StrokeThickness="2" StrokeMiterLimit="1">
这篇关于在wpf中绘制来回路径时出现奇怪的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文