简体   繁体   English

WinRT XAML中是否有相当于CombinedGeometry的等效项?

[英]Is there an equivalent to CombinedGeometry in WinRT XAML?

I'm trying to draw a square with a round hole in it, so that one can see what's behind the rectangle. 我正在尝试绘制一个带有圆孔的正方形,以便可以看到矩形后面的内容。 I've used the following code to accomplish this in WPF: 我使用以下代码在WPF中完成此操作:

<Path Grid.Row="0" Grid.Column="1" Stretch="Uniform" Stroke="Black" Fill="Yellow">
    <Path.Data>
        <CombinedGeometry GeometryCombineMode="Exclude">
            <CombinedGeometry.Geometry1>
                <RectangleGeometry Rect="0,0,100,100"></RectangleGeometry>
            </CombinedGeometry.Geometry1>
            <CombinedGeometry.Geometry2>
                <EllipseGeometry Center="50,50" RadiusX="40" RadiusY="40"></EllipseGeometry>
            </CombinedGeometry.Geometry2>
        </CombinedGeometry>
    </Path.Data>
</Path>

The CombinedGeometry class doesn't appear to exist in WinRT-XAML. 在WinRT-XAML中似乎不存在CombinedGeometry类。 Basically I want to create a game board that you drop pieces into from the top, and animate the pieces falling into place behind the board. 基本上,我想创建一个游戏板,您可以将其从顶部放下,并为落入板后位置的动画设置动画。

Any suggestions for what I should use instead of a CombinedGeometry? 关于我应该使用什么而不是CombinedGeometry的任何建议? ... or suggestions on how to get CombinedGeometry to work in WinRT-XAML? ...或有关如何使CombinedGeometry在WinRT-XAML中工作的建议?

Thanks! 谢谢! Dave 戴夫

It is not really an equivalent, but it can do the Job : 它实际上不是等效的,但可以完成工作:

  <!-- Creates a composite shape from three geometries. -->
  <GeometryGroup FillRule="EvenOdd">
    <LineGeometry StartPoint="10,10" EndPoint="50,30" />
    <EllipseGeometry Center="40,70" RadiusX="30" RadiusY="30" />
    <RectangleGeometry Rect="30,55 100 30" />
  </GeometryGroup>
</Path.Data>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM