Real Link of GoLabeled

Hi There, I have a small problem , I am using class "mylabeledLink" inherted from Golabeled link ... want to make my custom Arrowhead so what I did .. I make another class "myRealLink" inherited from GoLink and Override the Paint Function of this class to call my customized DrawArrowHead ..and I use this class as the realLink of "mylabeledLink" class as follow In the constructor of "mylabeledLink" ......mylabeledLink.RealLink=new myRealLink(this) The problem is that when I select the link .. the RealLink is the one selected and Its handles are not selected [can't reshape the link] ... I try to override SelectionObject of "myRealLink" class to return the "mylabeledLink" object sent in the constructor .. But it is not working as well . So I would really appreciate if I can get help how to make "mylabeledLink" link selected ..Or if there is more easy way to customize my Arrowhead instead of this way "the one I want to draw is back slash -\- head"

Actually, we have already added two new enumerations to GoStrokeArrowheadStyle (Slash and Backslash) for the next release.
I’ll see if I can find some code that implements this that will work on earlier versions. Also I think there’s some code floating around that demonstrates how to draw custom arrowheads.

Thanks for your fast response ..I would really apperciate if you could find this implementation to solve this issue for us .. Thanks in advance

This isn’t exactly what you’re asking for, but here’s an example that draws a hexagonal arrow-like arrowhead.
[Serializable]
public class TestLink : GoLink {
public TestLink() {
this.ToArrowShaftLength = 6;
this.FromArrowShaftLength = 6;
}
public override int GetArrowheadPointsCount(bool atEnd) {
return 6;
}
public override void CalculateArrowhead(PointF anchor, PointF endPoint, bool atEnd, PointF[] poly) {
// calculate the line length; if it is zero, pretend that it is one
// in order to avoid divide by 0 errors.
float x1 = endPoint.X;
float y1 = endPoint.Y;
float xPart = x1 - anchor.X;
float yPart = y1 - anchor.Y;
float line_length = (float)Math.Sqrt(xPart * xPart + yPart * yPart);
if (line_length < 0.01f) line_length = 0.01f;
// calculate the slope of the line
float cosine = xPart / line_length;
float sine = yPart / line_length;
float length;
float shaftlength;
float width;
if (atEnd) {
length = this.ToArrowLength;
shaftlength = this.ToArrowShaftLength;
width = this.ToArrowWidth;
} else {
length = this.FromArrowLength;
shaftlength = this.FromArrowShaftLength;
width = this.FromArrowWidth;
}
// calculate half the width
width /= 2;
// don’t let the arrowhead be bigger than the last segment of the stroke
float maxlength = Math.Max(length, shaftlength);
if (maxlength > 0 && line_length < maxlength && this.Style != GoStrokeStyle.Bezier) {
float scale = line_length/maxlength;
length = scale;
shaftlength = scale;
width = scale;
}
// determine the unrotated head’s points
// 1-------2
// \ <BR> // ----------0-------3 <==origin
// / /
// 5-------4
float initx0 = -shaftlength;
float inity0 = 0;
float initx1 = -length;
float inity1 = -width;
float initx2 = -length+shaftlength;
float inity2 = -width;
//float initx3 = 0;
//float inity3 = 0;
float initx4 = -length+shaftlength;
float inity4 = width;
float initx5 = -length;
float inity5 = width;
// rotate and translate the unrotated arrowhead
poly[0].X = x1 + (cosine
initx0 - sine
inity0);
poly[0].Y = y1 + (sine
initx0 + cosineinity0);
poly[1].X = x1 + (cosine
initx1 - sineinity1);
poly[1].Y = y1 + (sine
initx1 + cosineinity1);
poly[2].X = x1 + (cosine
initx2 - sineinity2);
poly[2].Y = y1 + (sine
initx2 + cosineinity2);
poly[3].X = x1;
poly[3].Y = y1;
poly[4].X = x1 + (cosine
initx4 - sineinity4);
poly[4].Y = y1 + (sine
initx4 + cosineinity4);
poly[5].X = x1 + (cosine
initx5 - sineinity5);
poly[5].Y = y1 + (sine
initx5 + cosine*inity5);
}
}

Thanks a lot …this will help us …
but we still face the same problem … we are using our custom inherited link class mylabeledLink from GoLabeledLink
In the constructor of “mylabeledLink” …
mylabeledLink.RealLink=new myRealLink(this) /// myRealLink is the one with custom arrowhead
The problem is that when I select the mylabeledLink… the RealLink is the one selected and Its handles are not selected [can’t reshape the link] … I try to override SelectionObject of “myRealLink” class to return the “mylabeledLink” object sent in the constructor … But it is not working as well .
So I would really appreciate if I can get help how to make “mylabeledLink” link selected …

GoLabeledLink.SelectionObject is already defined to return the RealLink, so you don’t need to do that again.
I suspect the problem is that either you didn’t override CreateRealLink to return an instance of your class, or that you didn’t set Selectable to false in your constructor (or later) when setting the GoLabeledLink.RealLink property. In the former case, the constructor for GoLabeledLink automatically sets the Selectable property of the object returned by CreateReaLink to false. In the latter case, you need to do this yourself, sometime.

Thank you so much … this works fine …