我需要在 DrawingVisual 中绘制一条折线。出于性能原因,我正在使用 StreamGeometry。我遇到的问题是我无法弄清楚如何启用抗锯齿。我在 StreamGeometry 或 DrawingContext 上找不到任何用于抗锯齿控制的方法或属性。
下面的代码在 IronPython 中,但没关系:
geometry = StreamGeometry()
context = geometry.Open()
context.BeginFigure(Point(10, 10), False, False)
context.LineTo(Point(100, 100), True, False)
context.LineTo(Point(200, 300), True, False)
context.Close()
dv = DrawingVisual()
dc = dv.RenderOpen()
dc.DrawGeometry(None, Pen(Brushes.Blue, 1), geometry)
dc.Close()