Draw a “L” using the DrawingContext

2019-03-04 23:18发布

I need to Draw (using System.Windows.Media.DrawingContext) a "L" in WPF. What is the optimal way to proceed?

Draw 2 lines? Draw a PolyLineSegment? (not sure how)

drawContext.DrawLine(myPen, topLeft, New Point(topLeft.X + 5, topLeft.Y))
drawContext.DrawLine(myPen, topLeft, New Point(topLeft.X, topLeft.Y + 5))

Actually, I need to surround a label with visible corners "L"-like...
I need to draw, not to use Templates or Decorators.

1条回答
Anthone
2楼-- · 2019-03-04 23:48

If your question is about adding as few as possible Drawing objects to your DrawingContext, you might populate a StreamGeometry and draw it by DrawGeometry.

查看更多
登录 后发表回答