Moving nodes only to some positions


I have several parallel vertical lines in my view. An I will force the user to move nodes only on one line.

In other words I will force the position of my nodes:

  • at one X (one in a set of Xs, the vertical lines).
  • at Y (between XMin and YMax, the length of the line).

Well, some kind off “super” grid.

Could you please give me some advise?



You have a choice, depending on whether you want to associate your code with a node class or with the class that holds your lines.
You could override GoObject.DoMove. You didn’t say if those vertical lines are only in the GoView or if they are in the GoDocument, but if they are in the view, you’ll have access to the GoView since it is an argument to DoMove.
Or you could implement IGoDragSnapper on the GoObject that contains those vertical lines. This is what GoGrid does. There is also another example of this in the LimitingSubGraph example class in Demo1 of version 2.5 (or an older version shown in