Original WPF applies a path path to draw arcs

Source: Internet
Author: User

Source: [Original]WPF apply path path to draw arc

1. Move command:move command (m): M start point or: M start point
For example: M 100,240 or M 100,240
When using uppercase M, the absolute value is expressed; When using lowercase m; Represents a value relative to the previous point, which is used if the previous point is not specified (0,0).

2. Draw the command (Draw command):
We can draw the following shapes:
(1) Lines: line (L)
(2) Horizontal lines: Horizontal line (H)
(3) Vertical: Vertical line (V)
(4) Three-time equation Bezier curve: Cubic Bezier curve (C)
(5) Two-time equation Bezier curve: quadratic Bezier curve (Q)
(6) Smoothing three-time equation Bezier curve: Smooth cubic Bézier curve (S)
(7) Smoothing two-time equation Bezier curve: Smooth quadratic Bézier curve (T)
(8) Elliptical Arc: Elliptical arc (A)

Draw instruction Format syntax:

(1) Lines: line (L)
Format:
l end point coordinate or: l end point coordinate.
For example: L 100,100 or L 100 100. The coordinate values can be in the form of X, Y (separated by commas in the middle) or × y (separated by a half-width space in the middle).

(2) Horizontal horizontal line (H): Draws a line from the current point to the specified x-coordinate.
format: H x Value or H x value (x is a value of type System.Double)
For example: H 100 or H 100, can also be: H 100.00 or H 100.00 and other forms.

(3) Vertical linear Vertical Line (V): Draws a line from the current point to the specified y-coordinate.
format: V y value or v y value (Y is a value of type System.Double)
For example: v 100 or Y 100, can also be: v 100.00 or v 100.00 and other forms.

(4) Three-time equation Bezier Cubic Bezier curve (C): Draws a three-time equation Bezier curve between the current point and the specified end point by specifying two control points.
format: C First Control point second control point end Point or C first Control point second control point end point
For example: C 100,200 200,400 300,200 or C 100,200 200,400 300,200
Where the point (100,200) is the first control point, the Point (200,400) is the second control point, and the point (300,200) is the end point.

(5) Two-time equation Bezier quadratic Bezier curve (Q): Draws a two-time equation Bezier curve from the current point to the specified end point by a specified control point.
format: Q Control point end points or Q control point end points
For example: Q 100,200 300,200. Where the point (100,200) is the control point, and the point (300,200) is the end point.

(6) smoothing three equation Bezier curves: Smooth cubic Bézier curve (S): smooth control of Bezier curves at the current point to a specified point by a specified point.
format: s control point end point or S control point end point
For example: S 100,200 200,300

(7) Smoothing two-time equation Bezier smooth quadratic Bézier curve (T): Similar to smoothing three-quadratic equation Bezier curve.
format: T control point end point or T control point end point
For example: T 100,200 200,300

(8) Elliptical Arc: Elliptical arc (A): draws an arc between the current point and the specified end point.
A dimension arc rotation angle Value Advantage arc mark positive and negative angle mark end point
Or:
A dimension arc rotation angle Value Advantage arc mark positive and negative angle mark end point
Size: System.Windows.Size type that specifies the radius value in the X, y direction of the ellipse arc.
Rotation angle (RotationAngle): system.double type.
Arc Rotation angle Value (rotationangle): The rotation angle value of an elliptical arc.
The mark of the dominant arc (Islargearcflag): Whether it is a dominant arc, if the angle of the arc is greater than or equal to 180 degrees, then set to 1, otherwise 0.
Positive and negative angle marker (Sweepdirectionflag): set to 1 when the positive angle direction is drawn, otherwise 0.
End point (endPoint): System.Windows.Point type.

3. Close command: Used to connect the first and last points of the graph in a straight line to form a closed area.
denoted by z or Z.

1    <CanvasMargin= "123,0,10,22">2             <PathStroke= "#FFE23838"strokethickness= "5"Width= "$"Height= "$"Strokedasharray= "2 1"Strokedashcap= "Round">3                 <Path.data>4                     <GeometryGroup>5                         <PathGeometryfigures= "M 100,10 A 100,100 0 0 0 200,10" />6                         <PathGeometryfigures= "M 100,50 A 100,100 0 1 0 200,50" />7                         <PathGeometryfigures= "M 100,450 A 100,100 0 1 1 200,450" />8                         <PathGeometryfigures= "M 100,500 A 100,50 1 0 300,500" />9                     </GeometryGroup>Ten                 </Path.data> One             </Path> A         </Canvas>

Ps:

45
The red part angle setting has been not good to use, do not know why?

Detailed Syntax Description: graphical representation syntax in WPF (Path Data property syntax)

Original WPF applies a path path to draw 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.