XAML 路径元素 - 如何制作软角 [英] XAML Path element - how to make soft corners
问题描述
我想弄清楚如何设置 Path 元素的 Data 属性以获得这种类型的软角:
I'm trying to figure out how to set Data property of the Path element to get soft corners of this type:
现在我只有这样的尖角:
Right now I have only sharp corners like this:
我尝试使用省略号,但我无法得到我想要的.
I tried playing with ellipses, but I can't get what I want.
谢谢
推荐答案
路径段具有 IsSmoothJoin 属性,默认为 false.我从未尝试过,但它似乎是一个不错的选择.
Segments of a path have a IsSmoothJoin property, defaulting to false. I have never tried it but it seems to be a good candidate.
另一个想法是使用折线(而不是路径,如果在您的情况下可以的话).PolyLine 具有 PenLineJoin 类型的 StrokeLineJoin 属性,它允许圆角.请参阅 MSDN,在 Strokes 下了解可能性.
Another idea is to use a PolyLine (instead of a Path, if that's OK in your case). PolyLine has the StrokeLineJoin property, of type PenLineJoin, which allow for rounded corners. See MSDN, under Strokes, for the possibilities.
添加了以下内容:其实StrokeLineJoin属性来自Shape类,Path是Shape的子类,所以可以直接在Path实例中使用这个属性.
added the following: Actually, the StrokeLineJoin property comes from the Shape class, and Path is a subclass of Shape, so you can use this property directly in the Path instance.
这篇关于XAML 路径元素 - 如何制作软角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!