1
我在应用程序中使用System.Windows.Shapes.Line在画布上绘制一条线。我想放一个形状,例如在线的开始和结束处有一个十字('x')?有没有办法通过设置一个属性来做到这一点。我可以根据坐标在画布上添加'x',但我希望能够直接使用某些Line属性来完成此操作。 目前我能够使用属性来绘制此= --------------- dashed line为下段: -在WPF中创建行和行尾的形状
var DistanceLine = new Line();
DistanceLine.Stroke = new SolidColorBrush(LineColor);
DistanceLine.StrokeDashArray = new DoubleCollection() {0, 4};
DistanceLine.StrokeDashCap = PenLineCap.Round;
DistanceLine.StrokeEndLineCap = PenLineCap.Round;
DistanceLine.StrokeLineJoin = PenLineJoin.Round;
DistanceLine.StrokeStartLineCap = PenLineCap.Round;
DistanceLine.StrokeThickness = 3;
我想是这样的= x ------------------ x dashed line with 'x' marks
如何在行尾制作自定义形状?
还有就是StrokeStartLineCap和StrokeEndLineCap属性:https://msdn.microsoft.com/en-us/library/ms754071(v=vs.110).aspx – mm8
@ mm8我已经在使用StrokeStartLineCap和StrokeEndLineCap(正如你在编辑的问题中看到的那样)。 –
“PenLineCap的4个枚举似乎没有达到目的”是什么意思?检查文档中的示例。 – mm8