Commands for the Geometry Mini-Language WPF in VB.NET

In this article you will learn about the all Commands for the Geometry Mini-Language in WPF.
  • 2885

As you learn now to simply work with Geometry Mini-Language in my previous article, now in this article we discuss about the Commands for the Geometry Mini-Language.

At the time of an geometry creation with the mini-language, you are actually creating a StreamGeometry object, not a PathGeometry. So, you won't be able to modify the geometry later on in your code. To resolve this problem we have an another type of geometry that is PathGeometry you can create a PathGeometry explicitly but use the same syntax to define its collection of PathFigure objects.

Syntax:

       
<Path Stroke="Blue">
        <Path.Data>
            <PathGeometry Figures="M 12,150 L 150,100 L 150,10 Z" />
        </Path.Data>
    </Path>

The geometry mini-language is easy to grasp. It uses a fairly small set of commands, which are given below:

  • 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.
     

  • M x,y
    Move to position x,y
     

  • L x,y
    Creates a straight line between the current point and the specified end point. Syntax: L endPoint Example: L 35,50.
     

  • H x
    Creates a horizontal LineSegment using the specified X value and keeping the Y value constant.
     

  • V y
    Draw a vertical line from the current position x0,y0 to position x0,y.
     

  • A radiusX, radiusY
    degrees isLargeArc,
    isClockwise x,y
    Creates an elliptical arc between the current point and the specified end point. Syntax: A radius, rotationAngle, isLargeArc, sweepDirection, endPoint isLargeArc, sweepDirection are 1 or 0 Example: M 10,100 A 100,50 45 1 0 200,100
     

  • C x1,y1 x2,y2 x,y
    Creates a cubic Bezier curve between the current point and the specified end point by using the two specified control points. Syntax: C controlPoint, controlPoint, endPoint Example: C 100,200 200,400 300,200
     

  • Q x1, y1 x,y
    Draw a quadratic Bezier segment with control points (x1,y1), and (x2,y2).
     

  • S x2,y2 x,y
    Creates a smooth cubic Bezier curve between the current point and the specified end point. Syntax: S controlPoint, endPoint Example: S 100,200 200,300
     

  • 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.

Conclusion

Hope this article help you to clear working of all the Commands for the Geometry Mini-Language in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.