[英]Draw the Polyline with border
我正在使用WPF绘制具有一定宽度的折线,示例代码如下:
DrawingContext.DrawGeometry(Brushes.Yellow,new Pen(Brush,polylineWidth),streamGeometry);
其中streamGeometry是折线的几何。 结果看起来像:
但是,我想在折线周围添加边框,如下所示:
我知道我可以绘制两条宽度不同的折线(一条用于黑色背景,另一条用于我要渲染的颜色),我只是想知道是否有任何API或某种优雅的方法可以实现这一点?
仅需完成一个额外的步骤。 用折线(包括折线的粗细)创建一个新形状。 采用:
var pathGeometry = streamGeometry.GetWidenedPathGeometry (new Pen(Brushes.Black, polylineWidth));
然后打电话
DrawingContext.DrawGeometry(Brushes.Yellow, new Pen(strokeBrush, strokeThickness), pathGeometry);
到此为止。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.