绘制" L"使用的DrawingContextQUOT、DrawingContext

2023-09-03 08:00:40 作者:焚寂

我要在WPF中绘制(使用 System.Windows.Media.DrawingContext )一个。 什么是继续进行的最佳方式?

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

2画线?绘制 PolyLineSegment ? (不知道如何)

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))

其实,我需要与周围可见的角落L状...... 标签 我需要的画的不可以使用模板或装饰。

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

推荐答案

如果你的问题是关于添加尽可能少绘图对象的的DrawingContext ,你可能会填充 StreamGeometry 并通过 DrawGeometry 。

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.