1、定义path;2、定义PathFigure;3、定义PathGeometry;4、PathGeometry加入PathFigure,PathFigure加入path,path加入canvas
Path thrustForceRec = new Path();
thrustForceRec.Fill = Brushes.Green;
PathFigure thrustForceFigure = new PathFigure();
thrustForceFigure.IsClosed = true;
thrustForceFigure.StartPoint = new Point(0, t1Position);
thrustForceFigure.Segments.Add(new LineSegment(new Point(100, t1Position), false));
thrustForceFigure.Segments.Add(new LineSegment(new Point(100, 250), false));
thrustForceFigure.Segments.Add(new LineSegment(new Point(0, 250), false));
PathGeometry thrustForceGeometry = new PathGeometry();
thrustForceGeometry.Figures.Add(thrustForceFigure);
thrustForceRec.Data = thrustForceGeometry;
thrustCanvas.Children.Add(thrustForceRec);