Click here to Skip to main content
15,891,743 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi I gonna a program allowing user to drag controls, Now request a assistant line that can be drag, and the controls nearby can follow this line to move or change their size.
Posted

1 solution


  1. Define for your application what exactly near means, e.g. a number of pixels making up a certain percentage of the total screen width for horizontal snap and the screens height for the vertical snap.
  2. Define how controls snap to this line, e.g. from the left of the line or from the right.
  3. When the line is moved (dragged or whatever), determine the distance of all controls, vertical distance for a horizontal snap line and horizontal distance for vertical snap line. If the distance is below the specified threshold do a vertical adjust to the lines y coordinate in the former and a horizontal adjust to the snap lines x coordinate in the latter case.

Implement that and you're just about done I'd say!

If you still have questions about this feel free to leave me a comment!

Regards,

Manfred
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 12-Jan-12 22:35pm    
Quite a plan, a 5.
--SA
dirk.zhang 14-Jan-12 0:54am    
thank you, I will have a try and must let you know
dirk.zhang 16-Jan-12 2:25am    
I have already given a try, and just like this method, make each control as An Class Cell and generate a class called AssistantLine that relate influential Cell which catalog four direction.

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