如何在 WPF 中的路径对象中设置不同的描边属性
我有一个路径形状,我想组合具有不同线条粗细的线条? StrokeThickness 属性是在 Path 对象上设置的,因此我无法针对不同的线更改它。如果我想改变线条颜色,也会出现同样的问题。
我想这样做的原因是这样我可以画一个箭头。 Charles Petzold 箭头 http://www.charlespetzold.com/blog/2007/04/191200.html 对我不起作用。如果我的线是虚线,封闭的箭头就会画得很奇怪。
我想出了一种方法,就是在我的路径/线的末端结合一个新的短线几何体,它比我原来的路径/线更粗,并且有 TriangleLineCap,瞧,给自己一个箭头。但我无法组合具有不同线条粗细和虚线类型等的几何图形。
有什么想法吗?
I have a path shape that I would like to combine lines that have different line thicknesses?
The StrokeThickness property is set on the Path object so I cannot change it for different lines. This same issue would arise if I wanted to change my line color.
The reason I want to do this is so that I can draw an arrowhead. Charles Petzold arrowheads http://www.charlespetzold.com/blog/2007/04/191200.html don't work for me. If my line is dashed the closed arrowhead draws weirdly.
I figured a way to do it was to combine at the end of my path/line a new short line geometry that was thicker than the my original path/line and had TriangleLineCap, voila, got myself an arrowhead. But I can't combine geometries that have different line thicknesses and dashed types, etc.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需在面板中使用多个 Path 对象(例如 Canvas 或 Grid),它们将在彼此之上绘制:
Just use multiple
Path
objects in a panel like a Canvas or a Grid where they will draw on top of each other: