Question about GoBoxPort

I Have GoBoxPort Around GoIconicNode. The GoBoxPort have only 4 points to link: MiddleTop, MiddleBottom, MiddleLeft and MiddleRight. Question- How make multi points around GoIconicNode?

For example:



Try this:
FromSpot = NoSpot;
ToSpot = NoSpot;

Good luck!

[QUOTE=huanyue] Try this:FromSpot = NoSpot;ToSpot = NoSpot;Good luck!

[/quote] No, its dont help me.

You can set the GoBoxPort.LinkPointsSpread property to spread the connection points out.


Its dont help me too. May I do something wrong???

This is class, inherits GoBoxPort.

Public Sub New()



Me.IsValidSelfNode = False

Me.IsValidTo = False

Me.Style = GoPortStyle.None

Me.FromSpot = NoSpot

Me.ToSpot = NoSpot

Me.LinkPointsSpread = True



End Sub





’ links within the subgraph connect to the CustomSubGraphPort/GoBoxPort from the inside

Public Overrides Function GetFromLinkDir(ByVal link As IGoLink) As Single

Dim result As Single = MyBase.GetFromLinkDir(link)

If (Not link.ToPort Is Nothing AndAlso _

Not link.ToPort.GoObject Is Nothing AndAlso _

link.ToPort.GoObject.IsChildOf(Me.Parent)) Then

result += 180

If (result > 360) Then

result -= 360

End If

End If

Return result

End Function



’ links within the subgraph connect to the CustomSubGraphPort/GoBoxPort from the inside

Public Overrides Function GetToLinkDir(ByVal link As IGoLink) As Single

Dim result As Single = MyBase.GetToLinkDir(link)

If (Not link.FromPort Is Nothing AndAlso _

Not link.FromPort.GoObject Is Nothing AndAlso _

link.FromPort.GoObject.IsChildOf(Me.Parent)) Then

result += 180

If (result > 360) Then

result -= 360

End If

End If

Return result

End Function





Public Overrides Function CanLinkFrom() As Boolean

Return MyBase.CanLinkFrom() AndAlso _

Me.LinksCount < Me.MaxLinks



End Function



Public Overrides Function CanLinkTo() As Boolean

Return (MyBase.CanLinkTo() AndAlso Me.LinksCount < Me.MaxLinks)

End Function



’ assume this kind of port is “hollow”, as specified by the half the parent’s margin

Public Overrides Function ContainsPoint(ByVal p As PointF) As Boolean

Dim rect As RectangleF = Me.Bounds

If (Not rect.Contains(p)) Then

Return False

End If

Dim sg As vSyncGORectangle = CType(Me.Parent, vSyncGORectangle)

If Not (sg Is Nothing) Then

Dim tlmargin As SizeF = sg.TopLeftMargin

Dim brmargin As SizeF = sg.BottomRightMargin

rect.X = rect.X + Math.Max(1, tlmargin.Width / 2)

rect.Y = rect.Y + Math.Max(1, tlmargin.Height / 2)

rect.Width = rect.Width - Math.Max(1, tlmargin.Width / 2 + brmargin.Width / 2)

rect.Height = rect.Height - Math.Max(1, tlmargin.Height / 2 + brmargin.Height / 2)

Return (Not (rect.Contains(p)))

Else

Return True

End If

End Function

Could you say more about what you are trying to achieve?


Now, user may connect link to 4-middle sides around the GoIconMode. I want, that user may connect link to all points around the GoIconicNode.

GoIconicNode, by default, just uses a GoPort with FromSpot and ToSpot set to NoSpot and the GoPort.Object set to the icon. This gives you a port for starting a link anywhere over the icon, and the links will be drawn from the edge of the icon, with the visual endpoint of the link at the center of the icon.

GoBoxPort doesn't have the same GoPort.Object, but it does give you a settable margin all the way around the BoxNode where can start a link.
So, both of these types of ports allow you to "connect link to all points around the GoIconicNode".
So, I'm afraid I still don't understand your requirement.
The airplanes are GoIconicNode with GoPort. The "BOX" is a GoBoxNode.