How To Add Ports To A Custom Symbol

16 Dec 20241 minute to read

The following code snippet illustrates how ports can be added to a custom symbol.

private CirclePort leftport;

private CirclePort rightport;

//Add these lines to MySymbol's Constructor

//Port locations

leftport = new CirclePort(new PointF(0, this.Height / 2));

rightport = new CirclePort(new PointF(this.Width, this.Height / 2));

//Append CirclePorts to MySymbol

AppendChild(leftport);

AppendChild(rightport);

//Make CenterPort visible

this.CenterPort.Visible = true;
Private leftport As CirclePort

Private rightport As CirclePort

'Add these lines to MySymbol's Constructor

'Port locations

leftport = New CirclePort(New PointF(0, Me.Height / 2))

rightport = New CirclePort(New PointF(Me.Width, Me.Height / 2))

'Append CirclePorts to MySymbol

AppendChild(leftport)

AppendChild(rightport)

'Make CenterPort visible

Me.CenterPort.Visible = True