Add extra port on GoBasicNode

I’m using GoDiagram Express. I’ve tried to add an extra port to a derived class of GoBasicNode. My code is below. But from everything I’ve seen on the forum and in the examples, it looks right. But my new port doesn’t appear. What am I forgetting?

public class goFunctions : GoBasicNode, IDataGetable, IDataNode{ private nodeTypes myType; private goDataPort rightPort;
public goFunctions(PointF loc):base(){
myType=nodeTypes.GOFUNCTION; this.rightPort=new goDataPort(); this.rightPort.Size=new SizeF(15,15); this.rightPort.Position=this.Position; this.rightPort.Style=GoPortStyle.Diamond; this.rightPort.Visible=true;

this.Port=new goDataPort();
this.Shape=new GoRectangle();
this.Location = loc;
this.Text = “goFunction”;
this.Brush = Brushes.Magenta;
public override void LayoutChildren(GoObject childchanged) {
base.LayoutChildren (childchanged);
this.Port.Position=new System.Drawing.PointF(this.Shape.Position.X-5, this.Shape.Position.Y+17f);
this.rightPort.Position=new System.Drawing.PointF(this.Shape.Position.X+this.Shape.Width, this.Shape.Position.Y+15f);



That’s not going to work, because the port is not a child of the node.

You could try using GoTextNode instead, since it has (up to) 4 ports.

Ok. That makes sense. So there’s no other way to add a port to a GoBasicNode? Just curious. Seems easy to implement with a GoTextNode.


btw, can I place an image inside the GoTextNode?

I suppose you could replace the Background object to be a GoImage.

Remember to set GoTextNode.AutoResizes to false so that the Background object isn't automatically resized to fit around the text as the label changes.