两个可移动对象之间的固定线 [英] Fixed line between two objects that are movable

查看:98
本文介绍了两个可移动对象之间的固定线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我能够在画布上移动两个对象,但是我想在两个对象之间放置一条线,并且在移动对象时,该线应固定在两个对象之间.就像在Visio中一样,我们放置两个矩形并在它们之间画一条线,即使这些矩形在移动,它也是固定的.

I am able to move two objects around a canvas, but I want to place a line between the two objects and when the object are being moved, the line should be fixed between the two objects. This is something like in Visio, we place two rectangles and draw a line between them and it is fixed even while the rectangles are moving.

谢谢

推荐答案

创建一个具有两个依赖项属性(AffectRender)的控件.这两个属性是要点.呈现控件时,请将这两点用作行的起点和终点.将两个点绑定到两个父对象的位置.当父对象移动时,线条应自动呈现.

或者至少就是这样-我从未做过! :)
Create a control which has two dependency properties (which AffectRender). These two properties are points. When the control is rendered use these two points as the start and end points of your line. Bind the two points to the positions of the two parent objects. When the parent objects move the line should render automatically.

Or at least thats the theory - I've never done it! :)


这篇关于两个可移动对象之间的固定线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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