GoLink: How to get/set the 2 bezier points

I really can’t figure out how to get/set the two points that define the bezier curve of a GoLabeledLink. Could somebody add a simple example code snippet.

Thank you!!
Lars

Hi Lars,

if i remember it right, the demo1 example contains a bezier line (or link) element. I would search the samples for ‘bezier’…

I once had a look at bezier in a GoObject. I think “real” points and bezier points an mixed in the point array. A straight line contains of two points. If you set style to bezier it containts four points: startpoint (idx: 0), bezierpoint for startpoint (idx: 1), bezierpoint for endpoint (idx: 2), endpoint (idx: 3).

And if you switch a three point stroke to bezier, the middle point gets two additional bezier points. One before and one after. So it makes seven points in sum.

If you want to add points to a bezier stroke manually, i would expect that you have to add three point at the right position.

Allthough i have not code to add here i hope it gives you an idea how to proceed.

Best regards,
Joern

Hi Joern,
Thank you for your answer. - I guess my problem is even more simple by nature: I can’t find any points-collection in the GoLabledLinks-instance/object. I still don’t know how to access/manipulate the bezier points. The only property i find to manipulate the bezier curve is Curviness. But this is just a single float value.

Kind regards,
Lars

Hi Lars,

GoLabeledLink is just a container class for a link and a label (derived from GoGroup). The link can be accessed via LabeledLink.RealLink property. The points should be available through LabeledLink.RealLink.GetPoint[idx].

Curviness is only relevant for links with .Orthogonal=true and .Style=RoundedLine. The value for curviness represents the radius at the corners of the stroke.

Hope this post is more helpfull Smile

Best regards,
Joern

Joern is right about getting the GoStroke/GoLink via the GoLabeledLink.RealLink property.

The Curviness property is used in two different but similar manners. It controls the size of the rounded corners when the GoStroke.Style is rounded and when Orthogonal is true. But it controls the distance of the control points off the straight line when the Style is Bezier.

Thank you, Joern,

I have solved the problem by using GoLink.RealLink.SetPoint. It looks like this:
_GoLink.RealLink.SetPoint(1, new PointF(_OuterRight + 100, input_FromNode.Top + (input_FromNode.Links.Count * 20) - 40)); _GoLink.RealLink.SetPoint(2, new PointF(_OuterRight + 100, input_ToNode.Top + (input_FromNode.Links.Count * 20) - 40 + 20));
:-) Lars