Windows Phone development (34): path tag syntax to: http://blog.csdn.net/tcjiaan/article/details/7492548

Source: Internet
Author: User

If you think that the method for drawing various geometric figures discussed above is too complicated, let's take a look at it now. Of course, we are very easy. This tutorial does not require exams or class rankings. It only provides readers with a new idea.

 

In this section, we will talk about the path marking method. With this stuff, you will feel that it will be much easier to draw the path, and it is not too late. How convenient is the path marking method? Let's look at an instance first.

 

[HTML]View plaincopyprint?

  1. <Path verticalalignment = "stretch" horizontalalignment = "stretch"
  2. Stroke = "lightgreen" strokethickness = "6"
  3. Data = "M12, 2 L35, 28 175, 69 h80 v260 m185, 400 60, 40 135,100 300,250"/>

 

Look.

 

How is it? Is it much more concise?

 

 

I. Mobile commands

 

This is easy to understand, that is, moving to a certain point, the next series of graphics are drawn with the point as the starting point, the syntax is as follows:

[HTML]View plaincopyprint?

  1. M <coordinate point> or M <coordinate point>

M indicates absolute positioning, and M indicates the offset relative to the previous vertex. If the instruction is moved and then multiple vertices are followed, a straight line connecting these points is created. See the following example.

[HTML]View plaincopyprint?

  1. <Path horizontalalignment = "stretch"
  2. Verticalalignment = "stretch"
  3. Stroke = "yellow" strokethickness = "6"
  4. Data = "M50, 26 145 95,335, 97 m200,"/>

Check the running effect first.

 

Note the difference between M and M above. It is an offset between the X axis + 200 and the Y axis + 145 at the last ending point.

 

 

 

Ii. Drawing commands

Here I will only list a few examples. For details, refer to msdn.

 

1. draw a straight line.

Syntax:

[HTML]View plaincopyprint?

  1. L <End Point> or L <End Point>

Example:

[HTML]View plaincopyprint?

  1. <Path horizontalalignment = "stretch"
  2. Verticalalignment = "stretch"
  3. Stroke = "yellow"
  4. Strokethickness = "6"
  5. Data = "m21, 15 L30, 17 150,300, 79 160,410"/>

 

 

Running effect.

 

2. besell Curve

(1) cubic besell Curve

Syntax: C Control Point 1 Control Point 2 end point, or C Control Point 1 Control Point 2 end point.

Example:

[HTML]View plaincopyprint?

  1. <Path horizontalalignment = "stretch"
  2. Verticalalignment = "stretch"
  3. Stroke = "yellow"
  4. Strokethickness = "6"
  5. Data = "M10, 5 60, 75 150,160 30,200"/>

 

(2) Secondary besell Curve

Syntax: Q Control Point End Point or Q Control Point End Point

Example:

[HTML]View plaincopyprint?

  1. <Path horizontalalignment = "stretch"
  2. Verticalalignment = "stretch"
  3. Stroke = "yellow"
  4. Strokethickness = "6"
  5. Data = "M10, 5 q200, 55 200,385"/>

 

 

3. Draw an arc

Syntax:

A size rotationangle islargearcflag sweepdireflaflag endpoint

-Or-

A size rotationangle islargearcflag sweepdireflaflag endpoint

 

Size: the arc size. X indicates the radius length on the X axis, and y indicates the radius degree on the Y axis.

Rotationangle: the arc angle.

Islargearcflag: If the arc angle is greater than or equal to 180 degrees, set it to 1; otherwise, set it to 0.

Sweepdireflag: If the arc is drawn in the positive direction, it is set to 1; otherwise, it is set to 0.

Endpoint: end point.

 

Example:

[HTML]View plaincopyprint?

  1. <Path horizontalalignment = "stretch"
  2. Verticalalignment = "stretch"
  3. Stroke = "yellow"
  4. Strokethickness = "6"
  5. Data = "M10, 30 a185, 230 90 0 1 200,435"/>

 

 

You may find that although this method is used, it is not convenient to draw a picture. Now, I understand why I do not focus on the reasons for this content. For a manual diagram of XAML, I just introduced it in a simple way. In actual development, it is not efficient and difficult.

In the next section, I will introduce you to a simpler plotting scheme.

Related Article

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.