New Pen

Hi Walter,
Ive tried something with limited success…
When I highlight a link an arrow appears please look at the below code snippet
public RealLink()
{
AdjustingStyle = GoLinkAdjustingStyle.End;
Curviness = -5;
HighlightWhenSelected = false;
HighlightPen = CustomPenProvider.HighlightPen();
Pen = CustomPenProvider.LinePen();
}
Above I have CustomPenProvider that does the following
public static Pen LinePen()
{
AdjustableArrowCap oAAC = new AdjustableArrowCap((float)5.0f, (float)5.0f);
oAAC.MiddleInset = (float)0.0f;
oAAC.Filled = true;
Pen pen = new Pen(Brushes.LightGreen);
pen.Width = 4.0f;
pen.CustomEndCap = oAAC;
return pen;
}
This creates the right size custom end cap, but bigger as I wanted
as you see in my code for the realink constructor…
Pen = CustomPenProvider.LinePen();
when I draw a link from “a” to “b” the line is small and has the normal line caps, this same code works for “highlight pen” though, the line is highlighted and the arrow appears in the color that i want, but when I draw that line, its still using the default values, I thought I could set the “GoView.NewGoLink.Pen = CustomPenProvider.LinePen();”
when i am dragging the line is uses that pen… when i let go of the mouse button it jumps back to the small line without the arrow as I want
Could you point me in the right direction please?
I thought it was on the GoLabeledLink on the realink, or on GoToolLinkingNew

Thanks

I just tried your code, with a similar definition for HighlightPen(), inside appropriate class definitions, and then set goView1.NewLinkClass = typeof(RealLink).
Everything worked just fine. I also tried it with GoLink.Highlight set to true. The temporary link (shown while drawing a new link) always used the custom cap, and the permanent link looked just like the temporary one.

Thanks for the quick reply
You see thats what works for me

what doesn’t work is that the default pens thickness is still as thin as ever… this works for “highlightpen” where i set the pen, but not the “Pen” property
RealLink inherits from GoLink as you would expect…

If the only change I make is to set
goView1.NewGoLink.Pen = CustomPenProvider.LinePen();
I never see a thin black line when drawing a new link – I only see thick light-green ones with big triangular arrow heads (i.e. end caps). This doesn’t use your RealLink class at all, although it obviously works when you use RealLink too.
I tried this in a copy of MinimalApp, just to be sure. Perhaps you have some event handler that is changing the Pen, or perhaps you have some other code that is interfering?

ah…
I got it ;-)