绘制箭头与路径数据wpf

时间:2011-12-12 15:35:02

标签: c# .net wpf

此箭头的Path.Data值是什么:

enter image description here

最大网格宽度和高度为18x18

1 个答案:

答案 0 :(得分:25)

MSDN的example default template for an Expander使用M 0 4 L 4 0 L 8 4 Z

大多数路径以字母"M"和x,y坐标开头,后跟由字符标识的线段,后跟参数的空格分隔数字,以字母"Z"结尾。所以M 0 4 L 4 0 L 8 4 Z表示

  • 从0,4开始
  • 画一条线达到4,0
  • 画一条线到8,4
  • 然后结束路径

我经常使用以下网站作为此“几何迷你语言”的参考指南:rcosic.wordpress.com/2009/08/11/wpf-geometry-mini-language

  <Path x:Name="CollapsedArrow"
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        Data="M 0 0 L 4 4 L 8 0 Z">
    <Path.Fill>
      <SolidColorBrush Color="{DynamicResource GlyphColor}" />
    </Path.Fill>
  </Path>
  <Path x:Name="ExpandededArrow"
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        Visibility="Collapsed"
        Data="M 0 4 L 4 0 L 8 4 Z">
相关问题