WPF GeometryDrawing与StreamGeometry

时间:2019-08-18 18:23:11

标签: c# wpf drawingvisual geometrydrawing

我知道系统绘制几何图形和形状的方式之间存在很大差异。在事件处理,性能或其他方面,GeometryDrawing和StreamGeometry之间有什么区别吗?以下示例会产生两个相等的对象吗?

var dv = new DrawingVisual();
using (DrawingContext dc = dg.RenderOpen())
{
    //GeometryDrawing
    dc.DrawLine(myPen, new Point(0, 0), new Point(10, 10));


    //StreamGeometry
    var sg = new StreamGeometry();
    using (StreamGeometryContext sgc = sg.Open())
    {
        sgc.BeginFigure(new Point(0, 0), false, false);
        sgc.LineTo(new Point(10, 10), true, true);
    }
    //sg.Freeze();
    dc.DrawGeometry(null, myPen, sg);
}

0 个答案:

没有答案