From the course: Windows Presentation Foundation 5: Interaction and Controls

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Work with Polyline and Polygon

Work with Polyline and Polygon

From the course: Windows Presentation Foundation 5: Interaction and Controls

Start my 1-month free trial

Work with Polyline and Polygon

- [Instructor] The next step up from the simple line is a line that contains multiple lines and in WPF that is the polyline and the polygon shape. I've got an example here on this page. This is a polyline. This is a polygon. They look almost identical. The idea behind a polyline is you define a series of points. And then once you're done defining the points, the shape itself draws the stroke through all of those points. So in this example, I've got five points down this side and five points up this side. The polygon also has a set of points. The only difference is that the polygon adds a final line segment that connects the final point to the starting point. So look over here. This is the starting point. This is the ending point. In the polygon, you see that it drew a line between those two points. And that's just for simplicity sake. You as a developer don't have to close it up and figure out where to draw the last point. You can let the polygon handle that for you. Other than that…

Contents