如何在两个面板之间应用“锚点" [英] how to apply 'anchor' between two panels

查看:76
本文介绍了如何在两个面板之间应用“锚点"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的步骤如下:

1.创建一个主窗体.
2.在主窗体中添加三个面板,分别名为panel_a,panel_b和panel_c.
3.将图像分配给这三个面板的backgroupimage.

我的要求如下:
我会移动panel_a,并希望panel_b和panel_c自动移动
并保持与panel_a的相关位置为原始位置.

我的问题如下:
我的要求似乎类似于"anchor"属性,但是,
仅当panel_a是panel_b和panel_c的容器时,"anchor"才有效.

但是,我的情况是panel_a不是panel_b和panel_c的容器,
现在我该如何达到我的要求呢?是否有任何锚"
该问题要实施的财产?感谢您的支持.

注意:
我已经为
实现了向下移动",移动鼠标"和向上移动"事件 每个面板,然后选择要在幻像组中的面板,然后
移动面板(幻影组),但是,当面板更多且
时 更多(大约50到100个面板,甚至更多),移动速度将为
严重下降,因此我将诸如"system_built锚属性"应用于
做移动问题的功能.我的想法是,如果我可以设置关系

My steps are below :

1. create a mainform.
2. add three panels into mainform, named panel_a, panel_b and panel_c.
3. assign image to backgroupimage of those three panels.

My requirement is below :
I would move panel_a, and hope panel_b and panel_c are automatically moved
and keep the related position to panel_a as original.

My question is below :
My requirement seems be similar to the ''anchor'' property, however, the
''anchor'' will work only when panel_a is a container of panel_b and panel_c.

But, my scenario is that panel_a is not a container of panel_b and panel_c,
and now how can I reach the function of my requirement ? Is there any ''anchor''
property to implement for this issue ? Thanks of your support.

Note:
I have implemented the ''mouse down'', ''mouse move'' and ''move up'' events for
each panel, and then to select panels to be in a phantom group, and then
to move panels (in a phantom group), however, when the panels are more and
more (around 50 to 100 panels, even more than it), the moving speed will be
down seriously, so I would apply such as ''system_built anchor property'' to
do the function for moving issue. My idea is that if I can set relationship
between panel_a and ''panel_b and panel_c'' by using such as ''anchor'' property.

推荐答案

要求不太明确,可以尝试放置屏幕转储到这里.
一个建议,
但是根据您的描述,我认为您可以尝试使用两个分离器面板,
在第一个拆分器面板的第二个面板中放置另一个拆分器面板
Requirement is not quite clear , you can try to put screen dump here.
one suggestion,
But based on your description ,i think you can try with two splitter panel,
in the second panel of first Splitter Panel put another splitter panel


Anchor属性几乎无济于事.尝试将面板与类System.Windows.Forms.Splitter组合使用,请参见 http://msdn. microsoft.com/en-us/library/system.windows.forms.splitter.aspx [
Anchor property can hardly help. Try combination of panels with the class System.Windows.Forms.Splitter, see http://msdn.microsoft.com/en-us/library/system.windows.forms.splitter.aspx[^], all those control using Dock property. This way, you might work it out without mouse event handlers, using just the mouse handler of the Splitter.

I generally advise to avoid Anchor in favor of Dock as Anchor required some manual layout (how to make it even on left and right, for example), and it tends to make controls flicker.

A note: if you think you need anything like 50 panels, it''s a sign of wrong UI design. Do you need all of the visible at the same time? Poor user… :-)

I usually advise some kind of index/detail design: have a list box or a tree view on the docked on the left, possible a splitter on the right of it, and the single panel on the right. The control on the left works like an index for the content on right. Handling the selection events on the left control, you put different panels onto the right panel. You can have a collection of hidden children panels with only one panel at a time visible or just one panel repopulating its children on each selection event.

—SA


使用webparts会执行相同的操作.

谢谢
-amit.
Use webparts it will do the same thing.

thanks
-amit.


这篇关于如何在两个面板之间应用“锚点"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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