Although this isn’t precisely what you are asking about, you might be interested in how the Processor sample animates dashed links to give the impression of the flow of stuff from one node to another. Run the Processor sample app, drag some nodes into the canvas, draw some links between the nodes, and then click the “Animate” button.
Basically what you want is having the temporary link (actually GoStroke) created by the link-drawing tool to paint its stroke backwards.
So here's a link class that paints itself backwards:
[Serializable]
public class TestTempLink : GoLink {
public TestTempLink() {
Pen p = new Pen(Color.Blue, 2);
p.DashStyle = DashStyle.Dash;
this.Pen = p;
}
// !!! doesn't handle lots of stuff, including arrowheads, shadow, jumpovers
public override void Paint(Graphics g, GoView view) {
Pen pen = this.Pen;
if (pen == null) return;
int npoints = this.PointsCount;
GraphicsPath path = MakePath();
path.Reverse();
DrawPath(g, view, pen, null, path);
}
}
And here's how you get your view's new-linking tool to use this class:
[Serializable]
public class TestLinkingNewTool : GoToolLinkingNew {
public TestLinkingNewTool(GoView view) : base(view) {}
protected override IGoLink CreateTemporaryLink(IGoPort fromPort, IGoPort toPort) {
IGoLink result = new TestTempLink();
result.FromPort = fromPort;
result.ToPort = toPort;
this.View.Layers.Default.Add(result.GoObject);
return result;
}
}
Install this tool by replacing the standard one:
goView1.ReplaceMouseTool(typeof(GoToolLinkingNew), new TestLinkingNewTool(goView1));