- 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.
- Define how controls snap to this line, e.g. from the left of the line or from the right.
- 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