如何在WPF画布中拖动时避免用户控件重叠 [英] How to avoid User Controls Overlapping while draging in wpf canvas

查看:219
本文介绍了如何在WPF画布中拖动时避免用户控件重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将用户控件动态添加到我的画布中.我想避免拖动时用户控件的重叠.我正在检查每个控件的水平和垂直位置.

i am adding user controls dynamically to my canvas. i want to avoid overlapping of user controls while draging. i am checking horizontal & vertical position of every control. is there any easy solution or proper way to implement this.

推荐答案

您可以使用intersectswith来确定用户控件是否与另一个控件相交:http://msdn.microsoft.com/en-us/library/system.windows.rect.intersectswith.aspx [^ ]

http://stackoverflow.com/questions/12288153/how-to-to-avoid-user-controls-overlapping-while-draging-in-wpf-canvas [ http://stackoverflow.com/questions/1554116/how-can-i-check-if-2-controls-overlap-eachother-on-a-canvas-in-wpf [
You can use intersectswith to find out if a user control intersects another: http://msdn.microsoft.com/en-us/library/system.windows.rect.intersectswith.aspx[^]

http://stackoverflow.com/questions/12288153/how-to-avoid-user-controls-overlapping-while-draging-in-wpf-canvas[^]
http://stackoverflow.com/questions/1554116/how-can-i-check-if-2-controls-overlap-eachother-on-a-canvas-in-wpf[^]


这篇关于如何在WPF画布中拖动时避免用户控件重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆