DrawingContext context = new DrawingContext(); Pen pen = new Pen(Brushes.Black, 2); context.DrawLine(pen, new Point(0, 0), new Point(800, 600));
DrawingContext context = new DrawingContext(); Pen pen = new Pen(Brushes.Red, 5); context.DrawLine(pen, new Point(100, 100), new Point(300, 200));
DrawingContext context = new DrawingContext(); Pen pen = new Pen(Brushes.Blue, 2); pen.DashStyle = new DashStyle(new double[] { 4, 4 }, 0); context.DrawLine(pen, new Point(50, 50), new Point(200, 50));The DrawLine method is part of the System.Windows.Media namespace and is included in the PresentationCore.dll package library.