我们可以用下面的xaml代码画一个三角形
<Path Stroke="Blue">
<Path.Data>
<PathGeometry>
<PathFigure IsClosed="True" StartPoint="10,100">
<LineSegment Point="100,100" />
<LineSegment Point="100,50" />
</PathFigure>
</PathGeometry>
</Path.Data>
</Path>下面的xaml代码会画一个和上面代码相同的三角形
<Path Stroke="Blue" Data="M 10,100 L 100,100 L 100,50 Z"/>第二段代码里面Data属性的值就是用Mini-Language定义的。下面是Geometry Mini-Language的命令说明
Command Description
F value Sets the Geometry.FillRule property. Use 0 for EvenOdd, or 1 for NonZero.
This command must appear at the beginning of the string (if you decide to use it).
M x,y Creates a new PathFigure for the geometry and sets its start point. This
command must be used before any other commands except F. However, you
can also use it during your drawing sequence to move the origin of your
coordinate system. (The M stands for move.)
L x,y Creates a LineSegment to the specified point.
H x Creates a horizontal LineSegment using the specified X value and keeping the
Y value constant.
V y Creates a vertical LineSegment using the specified Y value and keeping the
X value constant.
A radiusX, radiusY Creates an ArcSegment to the indicated point. You specify the radii of the
degrees isLargeArc, ellipse that describes the arc, the number of degrees the arc is rotated, and
isClockwise x,y Boolean flags that set the IsLargeArc and SweepDirection properties
described earlier.
C x1,y1 x2,y2 x,y Creates a BezierSegment to the indicated point, using control points at
(x1, y1) and (x2, y2).
Q x1, y1 x,y Creates a QuadraticBezierSegment to the indicated point, with one control
point at (x1, y1).
S x2,y2 x,y Creates a smooth BezierSegment by using the second control point from the
previous BezierSegment as the first control point in the new BezierSegment.
Z Ends the current PathFigure and sets IsClosed to true. You don’t need to use
this command if you don’t want to set IsClosed to true—instead, simply use M
if you want to start a new PathFigure or end the string.
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Command Description
F value Sets the Geometry.FillRule property. Use 0 for EvenOdd, or 1 for NonZero.
This command must appear at the beginning of the string (if you decide to use it).
M x,y Creates a new PathFigure for the geometry and sets its start point. This
command must be used before any other commands except F. However, you
can also use it during your drawing sequence to move the origin of your
coordinate system. (The M stands for move.)
L x,y Creates a LineSegment to the specified point.
H x Creates a horizontal LineSegment using the specified X value and keeping the
Y value constant.
V y Creates a vertical LineSegment using the specified Y value and keeping the
X value constant.
A radiusX, radiusY Creates an ArcSegment to the indicated point. You specify the radii of the
degrees isLargeArc, ellipse that describes the arc, the number of degrees the arc is rotated, and
isClockwise x,y Boolean flags that set the IsLargeArc and SweepDirection properties
described earlier.
C x1,y1 x2,y2 x,y Creates a BezierSegment to the indicated point, using control points at
(x1, y1) and (x2, y2).
Q x1, y1 x,y Creates a QuadraticBezierSegment to the indicated point, with one control
point at (x1, y1).
S x2,y2 x,y Creates a smooth BezierSegment by using the second control point from the
previous BezierSegment as the first control point in the new BezierSegment.
Z Ends the current PathFigure and sets IsClosed to true. You don’t need to use
this command if you don’t want to set IsClosed to true—instead, simply use M
if you want to start a new PathFigure or end the string.