请教个关于System.Windows.Shapes.Path绘制两种以上颜色问题

海涵德 2014-04-10 09:07:29
例如
<Path Stroke="Blue" StrokeThickness="1"  Fill="Blue"  Name="PanUp">
<Path.Data>
<GeometryGroup FillRule="Nonzero">
<PathGeometry >
<PathGeometry.Figures >
<PathFigure StartPoint="40,40" IsFilled="True" >
<PathFigure.Segments >
<LineSegment Point="75,75" ></LineSegment>
<LineSegment Point="110,40"></LineSegment>
</PathFigure.Segments>
</PathFigure>
<PathFigure StartPoint="110,40">
<PathFigure.Segments>
<ArcSegment Size="50,50" RotationAngle="45" IsLargeArc="False" SweepDirection="Counterclockwise" Point="40,40"/>
</PathFigure.Segments>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</GeometryGroup>
</Path.Data>
</Path>

怎样能在一个Path的第一个绘制红色
  <PathFigure StartPoint="40,40" IsFilled="True"  >
<PathFigure.Segments >
<LineSegment Point="75,75" ></LineSegment>
<LineSegment Point="110,40"></LineSegment>
</PathFigure.Segments>
</PathFigure>
在第二个绘制蓝色填充
<PathFigure StartPoint="110,40">
<PathFigure.Segments>
<ArcSegment Size="50,50" RotationAngle="45" IsLargeArc="False"
weepDirection="Counterclockwise" Point="40,40"/>
</PathFigure.Segments>
</PathFigure>
为什么不能这样做,要不就使用两个Path,这样在代码中使用很不方便。

...全文
275 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
ProjectDD 2014-04-27
  • 打赏
  • 举报
回复
用多个Path 似乎没什么别的好办法
海涵德 2014-04-11
  • 打赏
  • 举报
回复
最好直接回答问题,道理不用讲。
Bonjour-你好 2014-04-10
  • 打赏
  • 举报
回复
几何图形与形状比较 System.Windows.Shapes.Shape 类拥有 Geometry 及其派生类所没有的 Fill、Stroke 和其他呈现属性。 Shape 类是一个 FrameworkElement,因而会参与布局系统;其派生类可用作支持 UIElement 子项的任何元素的内容。 另一方面,Geometry 类只定义形状的几何图形,无法呈现自身。 由于它十分简单,因而用途更加广泛。

8,757

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧