Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
Sergey Alexandrovich Kryukov 29-Nov-11 22:09pm    
Layout is not quite clearly described.
--SA

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
 
Share this answer
 
Comments
Sports Kuo 13-Dec-11 0:23am    
Thanks of your suggestion. I've designed a similar function of it in my program before, and it seems be not the case I request.
Yes, may be I did not decsribe it clearly, any way, thanks so much.
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
 
Share this answer
 
Comments
Sports Kuo 13-Dec-11 0:58am    
Sorry to late response, acturally, I'm buzy on solving my urgent
progrm bug ...

I always thanks of your knind answer before, this time I again need your fully support on it, Thanks so much.

First, I would thanks of your suggestion regarding 'splitter',
however, I've alraedy implemented this kind of function in my progrm for differnt using, but, I know it may not meet my request.

Second, my program has an option to allow user to create more 'so called control' on form, it could be any number for user to create, plus, it's visible, and can be grouped together to be a 'locked group'.

Third, the most important are below :
1. each control will be assigned an image to control.backgroupimage for user's custimization. (not only a backcolor)
2. each control or group can be moved and resizale, such as the popular application of 'Visio' which allow user to create more object, move and resize it, to build a 'flowchart'.
3. I assign 'panel' object to each control, plus, each control has 8 small panels (I call it 'small square') attached in 8 directions of each control for user to click to resize it.

My problem is :
1. When the controls are more and more, the movement will be
more slower.
2. I found that there are two critical issues :
a. to set new control location.
b. to set visible true/false of 'samll square', and set new location of it.
==> both will impact the move speed.

My question now is :
I understnad that the current way I implement is not the good way to create and move control, however, I still can not find any correct and efficint way to do it, could you help to provide some sample with kernel code for 'create/move' issue ?
Since I may found some article of it, it only provide 'DLL' for kernel moveming reference instead of source code.
Use webparts it will do the same thing.

thanks
-amit.
 
Share this answer
 
Comments
Sports Kuo 13-Dec-11 0:25am    
My progrm is a simple windows form, I'm not familiar with this kind of web control. But, always thanks of your suggesionl.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900