【问题标题】:Equivalent of IsFilled="false" for PathFigure in Path Mini-language (Silverlight/WPF)Path Mini 语言 (Silverlight/WPF) 中 PathFigure 的 IsFilled="false" 等效项
【发布时间】:2011-02-17 22:16:42
【问题描述】:

我正在尝试找到在 PathGeometry 中使用的 IsFilled="False" 的等价物,但对于 Path Mini

您可以看到下面的两条路径是相同的,除了具有几何图形的路径在第二个 <PathGeometry>.<PathGeometry.Figures>.<PathFigure> 中具有 IsFilled="False"。这是所需的行为,但我希望将它用于 Path Mini(即在第一个 <Path> 中)。我查看了文档,但似乎找不到任何内容,因为 Path Mini 似乎不是数字集合。

据我了解,所有形状/几何图形都会在运行时转换为迷你路径,那么有没有办法反映编译后的 XAML 以查看解释器如何将带有 PathGeometry 的形状/几何图形呈现为迷你路径?

<Canvas Background="#FDB" Width="800" Height="600">

  <!-- this is the LEFT-HAND Path in the picture above -->
  <Path Canvas.Left="100" Canvas.Top="100"
     Stroke="#385D8A" StrokeThickness="2" StrokeLineJoin="Round" Fill="#4F81BD"
     Data="M0,0L102,0L102,102L0,102Z M46.15,49.01L-73.36,130.99L-96.42,-96.12L109.35,355.18">
  </Path>

  <!-- this is the RIGHT-HAND Path in the picture above -->
  <Path Canvas.Left="300" Canvas.Top="100" Stroke="#385D8A" StrokeThickness="2" StrokeLineJoin="Round" Fill="#4F81BD">
    <Path.Data>
      <GeometryGroup>
        <PathGeometry>
          <PathGeometry.Figures>
            <PathFigure StartPoint="0,0" IsClosed="True">
              <PathFigure.Segments>
                <LineSegment Point="102,0" />
                <LineSegment Point="102,102" />
                <LineSegment Point="0,102" />
              </PathFigure.Segments>
            </PathFigure>
          </PathGeometry.Figures>
        </PathGeometry>
        <PathGeometry>
          <PathGeometry.Figures>
            <PathFigure IsFilled="False" StartPoint="46.15,49.01">
              <PathFigure.Segments>
                <LineSegment Point="-73.36,130.99" />
                <LineSegment Point="-96.42,-96.12" />
                <LineSegment Point="109.35,355.18" />
              </PathFigure.Segments>
            </PathFigure>
          </PathGeometry.Figures>
        </PathGeometry>
      </GeometryGroup>
    </Path.Data>
  </Path>
</Canvas>

【问题讨论】:

    标签: wpf silverlight path pathgeometry


    【解决方案1】:

    路径迷你语言仅支持轮廓,因此必须将笔触转换为填充。如果您想要一像素宽的线条并且您对斜接或端盖不太挑剔,这很容易自己做。只需使用细长的矩形。使用最少的点数和处理交叉点的无限窄笔划的真正数学“增长”相当困难。但是,您也许可以使用 WPF 渲染引擎来为您执行此操作,因为显然它已经可以执行此操作了。

    【讨论】:

    • 谢谢瑞克。接受,因为这似乎是唯一的答案。你知道关于 path mini 的任何文档比我上面提供的链接更详细吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-23
    • 1970-01-01
    • 2011-03-15
    • 1970-01-01
    • 1970-01-01
    • 2010-12-16
    相关资源
    最近更新 更多