使用Path描绘两个图形

代码

  1. <Grid>
  2. <StackPanel
  3. HorizontalAlignment="Center"
  4. VerticalAlignment="Center"
  5. Orientation="Horizontal">
  6. <Path Stroke="Blue" StrokeThickness="1">
  7. <Path.Data>
  8. <PathGeometry>
  9. <PathFigure StartPoint="0,0">
  10. <PolyLineSegment Points="100,0 100,90 55,90 50,100 45,90 0,90 0,0" />
  11. </PathFigure>
  12. </PathGeometry>
  13. </Path.Data>
  14. </Path>
  15. <Path
  16. Margin="5"
  17. Stroke="Red"
  18. StrokeThickness="1">
  19. <Path.Data>
  20. <PathGeometry>
  21. <PathFigure StartPoint="5,0">
  22. <LineSegment Point="95,0" />
  23. <ArcSegment
  24. Point="100,5"
  25. Size="5,5"
  26. SweepDirection="Clockwise" />
  27. <LineSegment Point="100,85" />
  28. <ArcSegment
  29. Point="95,90"
  30. Size="5,5"
  31. SweepDirection="Clockwise" />
  32. <PolyLineSegment Points="55,90 50,100 45,90 5,90" />
  33. <ArcSegment
  34. Point="0,85"
  35. Size="5,5"
  36. SweepDirection="Clockwise" />
  37. <LineSegment Point="0,5" />
  38. <ArcSegment
  39. Point="5,0"
  40. Size="5,5"
  41. SweepDirection="Clockwise" />
  42. </PathFigure>
  43. </PathGeometry>
  44. </Path.Data>
  45. </Path>
  46. </StackPanel>
  47. </Grid>

效果

image.png