2009-11-12 72 views
0

我试图画一个手工制作的鼓形状相似。问题在于顶部椭圆没有完全填充。 样品:FillRule失败时如何填充重叠区域?

<Page 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
    <Grid> 
     <Image Width="126" Height="42" Margin="3" HorizontalAlignment="Left" VerticalAlignment="Top"> 
      <Image.Source> 
       <DrawingImage> 
        <DrawingImage.Drawing> 
         <GeometryDrawing Brush="Silver"> 
          <GeometryDrawing.Pen> 
           <Pen Brush="Black" Thickness="1" LineJoin="Bevel" EndLineCap="Round" StartLineCap="Round" /> 
          </GeometryDrawing.Pen> 
          <GeometryDrawing.Geometry> 
           <GeometryGroup FillRule="NonZero"> 
            <EllipseGeometry Center="62,8" RadiusX="62" RadiusY="5" /> 
            <PathGeometry> 
             <PathFigure StartPoint="0,8" IsClosed="False"> 
              <LineSegment Point="0,38" /> 
              <QuadraticBezierSegment Point1="60,49" Point2="124,38" /> 
              <LineSegment Point="124,8" /> 
             </PathFigure> 
            </PathGeometry> 
           </GeometryGroup> 
          </GeometryDrawing.Geometry> 
         </GeometryDrawing> 
        </DrawingImage.Drawing> 
       </DrawingImage> 
      </Image.Source> 
     </Image> 

    </Grid> 
</Page> 

解决此问题的任何替代方法? 谢谢。

回答

0

终于...该解决方案是使两个独立的路径图使用弧段:

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
<Grid> 
    <Image Width="126" Height="42" Margin="3" HorizontalAlignment="Left" VerticalAlignment="Top"> 
     <Image.Source> 
      <DrawingImage> 
       <DrawingImage.Drawing> 
        <GeometryDrawing Brush="Silver"> 
         <GeometryDrawing.Pen> 
          <Pen Brush="Black" Thickness="1" LineJoin="Bevel" EndLineCap="Round" StartLineCap="Round" /> 
         </GeometryDrawing.Pen> 
         <GeometryDrawing.Geometry> 
          <GeometryGroup x:Key="Drum" FillRule="NonZero"> 
           <PathGeometry> 
            <PathFigure StartPoint="0,6" IsClosed="True"> 
             <ArcSegment Point="125,6" IsLargeArc="False" IsStroked="True" SweepDirection="Clockwise" Size="15,1.5" /> 
             <ArcSegment Point="0,6" IsLargeArc="False" IsStroked="True" SweepDirection="Clockwise" Size="15,1.5" /> 
            </PathFigure> 
           </PathGeometry> 
           <PathGeometry> 
            <PathFigure StartPoint="0,6" IsClosed="True"> 
             <ArcSegment Point="125,6" IsLargeArc="False" IsStroked="True" Size="15,1.5" IsSmoothJoin="True" /> 
             <LineSegment Point="125,35" IsSmoothJoin="True" /> 
             <ArcSegment Point="0,35" IsLargeArc="False" IsStroked="True" SweepDirection="Clockwise" Size="15,1.5" IsSmoothJoin="True" /> 
             <LineSegment Point="0,6" IsSmoothJoin="True" /> 
            </PathFigure> 
           </PathGeometry> 
          </GeometryGroup> 
         </GeometryDrawing.Geometry> 
        </GeometryDrawing> 
       </DrawingImage.Drawing> 
      </DrawingImage> 
     </Image.Source> 
    </Image> 
</Grid> 
</Page>