在Form上一起移动控件 [英] Move controls together on Form

查看:73
本文介绍了在Form上一起移动控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表单上有成对的面板。在每个面板对中具有相同的Tag属性。当其中一个面板在Form上移动时如何移动两个面板?如果有任何想法请分享。

On Form there are pairs of panels. In each panel pair have same Tag property. How to move both panels when one of them is moving at time on Form? if have any idea please share.

推荐答案

您可以使用事件移动调整大小

如果一个面板移动,你也可以移动另一个面板。



你可以选择让一个面板是主面板,只实现该面板的事件。



你也可以实现两个面板的事件,让两个面板控制另一个面板。

在这种情况下,你需要注意递归行为。

执行的第一个Move事件需要暂时禁用其他面板移动事件。否则,您的GUI可能会有一些很酷的效果。
You can use the events Move and Resize.
If one panel moves you can move the other panel too.

You can choose to let one panel be the master and only implement the events for that panel.

You can also implement the events for both panels and let both control the other.
In this case you need to beware of recursive behavior.
The first Move event that is executed needs to temporarily disable the other panels move event. Otherwise you might have some cool effects in your GUI.


这篇关于在Form上一起移动控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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