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.
Create drawings with Path
From the course: Windows Presentation Foundation 5: Interaction and Controls
Create drawings with Path
- [Instructor] Use the path class when you want to create the most sophisticated shapes including things like Bezier curves and arcs. Here's an example of a path. First thing you want to notice about it is that it is a shape so it support all the properties that we've already discussed like Stroke and StrokeThickness. You can use framework element properties like margin. I could set a fill for this if I wanted to. I can set a fill so you can see the white background through there. In this case, I decided not to use a solid color brush for this stroke so I define a stroke here in this section as a LinearGradientBrush. Then the next step when you're creating a path is to define the data points that are used to draw the shape. And they're inside this area. This is quite some syntax here but let's just point out the key points. On line 33 is the PathFigure. That's how I specify the starting point which is right here at this location. Then I specify a bunch of other elements to put in…
Contents
-
-
-
-
-
-
-
Overview2m 50s
-
Use the Shape Stretch property3m 34s
-
Set the Fill and Stroke brushes6m 25s
-
Work with the line shape3m 33s
-
Work with Polyline and Polygon6m 45s
-
Use the StrokeDashArray and EndCap properties4m 52s
-
Create drawings with Path5m 49s
-
Use Blend for Visual Studio to draw a Path5m 24s
-
Hit testing with geometries4m 2s
-
-
-
-
-
-
-
-