in the Demo Sample you use the following:
Dim View As GoView = GetCurrentGoView()
If (Not (View Is Nothing) AndAlso View.CanInsertObjects()) Then
View.Tool = New PortMovingTool(View)
End If
Is it possible to snap the GoPorts to the Grid?
in the Demo Sample you use the following:
PortMovingTool is derived from GoTool, so it doesn’t have any of the grid-snapping logic that GoDraggingTool has. You’d have to add logic to the DoMouseMove to honor snap points.
which would be something like this in your PortMovingTool override for DoMouseMove:
…
PointF oldspot = myPort.Location;
PointF newspot = new PointF(oldspot.X + myOffset.Width, oldspot.Y + myOffset.Height);
myPort.Location = this.View.SnapPoint(newspot, myPort);
…
work 100%, I just used Port.Center. Thanks