WPF foreground draw arc is simple, such as: <path x:name= "Path_data" stroke= "#FFE23838" strokethickness= "1" data= "M 100,0 A 50,100 0 0 0 100,200" &G T;</path>
Note: M start point (100,0) A dimension (x50,y100 radius) arc rotation angle value (0) The mark of the dominant arc (no, arc angle less than 180) positive and negative angle marker (0 counterclockwise circle) end point (100,200)
So draw the graph for
Due to the needs of the project, the need to dynamically draw arcs in the background, pointcuts ArcSegment, one step to explore the drawing method.
ArcSegment (point point, Size size, double rotationangle, bool IsLargeArc, sweepdirection sweepdirection, bool isstroked);
Since point is the end point, you need to define the start StartPoint, and try to have this property, and the background drawing is out. The code is as follows
Path PATH = new Path (); PathGeometry PathGeometry = new PathGeometry (); ArcSegment arc = new ArcSegment (new Point (+), new Size ((0), Sweepdirection.counterclockwise, False, True);P Athfigure figure = new PathFigure (); StartPoint = new Point (0); Segments.add (ARC);p athGeometry.Figures.Add (figure);p Ath. Data = Pathgeometry;path. Stroke = Brushes.orange;canvas. Children.add (path);
WPF background Drawing arcs