|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows;
namespace Editor
{
public static class DrawingContextHelper
{
public static void DrawPolyline(this DrawingContext dc, Point startPoint, PointCollection points, Pen pen)
{
PathGeometry geometry = new PathGeometry();
PolyLineSegment segment = new PolyLineSegment();
segment.Points = points;
PathFigure fig = new PathFigure(startPoint, new[] { segment }, false);
geometry.Figures.Add(fig);
dc.DrawGeometry(null, pen, geometry);
}
public static void FillPolylineGeometry(this DrawingContext dc, Point startPoint, PointCollection points)
{
PathGeometry geometry = new PathGeometry();
PolyLineSegment segment = new PolyLineSegment();
segment.Points = points;
PathFigure fig = new PathFigure(startPoint, new[] { segment }, true);
geometry.Figures.Add(fig);
dc.DrawGeometry(Brushes.Black, null, geometry);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a full-stack developer. My skills include JavaScript, C#/.Net, MS Azure cloud etc. I love to work on complex programming tasks requiring deep analysis, planning and use of efficient algorithms and data structures.