检查 WPF 中的重叠形状
我有一组需要在彼此之上绘制的形状。我需要对它们重新排序,以便最后绘制最小的形状(即它将最接近用户)。有什么方法可以检查一个形状是否与另一个形状重叠(包围和/或相交)。我知道 Rect 结构中有一个名为 Contains 的方法,它检查其中是否有对象。是否有类似的方法或方法可以在 WPF 中的 Shapes 上模拟它?预先感谢您的任何帮助。
干杯,
尼禄
I have a set of shapes which need to be drawn on top of each other. I need to re-order them such that the smallest shape gets drawn last (i.e. it will be closest to the user). Is there any way to check whether a shape overlappes (encloses and/or intersects) another shape. I know there is a method in Rect
structure called Contains
which checks whether there is an object within it. Is there a similar method or a way to simulate it on Shapes in WPF? Thanks in advance for any help.
Cheers,
Nilu
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能可以使用
Geometry.FillContainsWithDetail
方法。恕我直言,它的名字选得不好,但描述很清楚:我之前已经成功地将它用于碰撞测试,所以它也应该适合你......
You could probably use the
Geometry.FillContainsWithDetail
method. Its name is ill-chosen IMHO, but the description is clear :I have successfully used it for collision testing before, so it should work for you too...