WPF background Drawing arcs

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.