UIElement上的多个几何剪辑

UIElement上的多个几何剪辑

本文介绍了UIElement上的多个几何剪辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在为Windows Phone 7使用C#,Silverlight,Visual Studio.

I am using C#, Silverlight, Visual Studio for Windows Phone 7.

是否可以提供UIElement多个Geometry剪辑?等同于:

Is there a way to give a UIElement multiple Geometry clips? Something equivalent to:

Path myPath = new Path();
myPath.Data = myRectangle; // say of size 100x100
myPath.Clip = myClipRect; // smaller rectangle, say of size 20x20, located at (0,0)
myPath.Clip = myClipEllipse; // circle of radius 30, centered on myRectangle

现在,myClipEllipse将覆盖myPath.Clip中的myClipRect,因此仅显示myClipEllipse.我正在寻找一个可以正确绘制这两个剪辑的myRectangle的结果(即未反转).

Right now, myClipEllipse will override myClipRect in myPath.Clip, so only myClipEllipse will be displayed. I'm looking for a result that draws myRectangle with both of these clips correctly (ie, not inverted).

推荐答案

我最终使用GeometryGroup类(此处的文档).只需将所有几何图形作为GeometryGroup的子级,然后将此GeometryGroup提供给Clip.

I ended up solving this using a GeometryGroup class (docs here). Just put all the geometries as children of the GeometryGroup, and give this GeometryGroup to the Clip.

这篇关于UIElement上的多个几何剪辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:22