This is a follow up from this question.
Question:
I am trying to draw a filled triangle using DrawingContext
, which is rendered on a DrawingVisual
Currently, I have managed to draw the outline of a triangle using the following C# code:
private DrawingVisual CreateTriangle()
{
DrawingVisual triangle = new DrawingVisual();
using ( DrawingContext dc = triangle.RenderOpen() )
{
Pen drawingPen = new Pen(Brushes.Black,3);
dc.DrawLine(drawingPen, new Point(0, 50), new Point(50, 0));
dc.DrawLine(drawingPen, new Point(50, 0), new Point(50, 100));
dc.DrawLine(drawingPen, new Point(50, 100), new Point(0, 50));
}
return triangle;
}
I get this:
How do I draw a triangle that, in addition to th border I have drawn also has a red fill?