How to invert clipping geometry in Silverlight/WPF?

寵の児 提交于 2019-12-04 00:24:02
AnthonyWJones

One approach in Silverlight is to use a GeometryGroup and include in the group a very large rectangle starting at a distant negative position.

For example the following blue square has smaller square hole:-

    <Rectangle Fill="Blue" HorizontalAlignment="Center" VerticalAlignment="Center" Height="200" Width="200">
        <Rectangle.Clip>
            <GeometryGroup>
                <RectangleGeometry Rect="-2048 -2048 4096 4096" />
                <RectangleGeometry Rect="100 100 50 50" />
            </GeometryGroup>
        </Rectangle.Clip>
    </Rectangle>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!