Draw a “L” using the DrawingContext

自闭症网瘾萝莉.ら 提交于 2019-12-20 06:14:12

问题


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:


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.



来源:https://stackoverflow.com/questions/9615666/draw-a-l-using-the-drawingcontext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!