Compartilhar via


NodeShape.EnsureConnectionPoints Method

Override to set points on the edge of the shape at which connectors should terminate.

Namespace:  Microsoft.VisualStudio.Modeling.Diagrams
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll)

Syntax

'Declaração
Public Overridable Sub EnsureConnectionPoints ( _
    link As LinkShape _
)
public virtual void EnsureConnectionPoints(
    LinkShape link
)
public:
virtual void EnsureConnectionPoints(
    LinkShape^ link
)
abstract EnsureConnectionPoints : 
        link:LinkShape -> unit 
override EnsureConnectionPoints : 
        link:LinkShape -> unit 
public function EnsureConnectionPoints(
    link : LinkShape
)

Parameters

Remarks

Connection points are points on the perimeter of a shape to which the routing engine will preferentially attach connectors. If there are no connection points, the connectors will be attached anywhere along the edge of the shape.

Override this method to set connection points on a shape. It is called before the first link is connected to each shape instance. Once connection points are set for a particular shape instance, they apply to all connections made to that instance, irrespective of the link type.

Connection points do not prevent the user from moving the end point of a connector. If you want to attach connectors to a specific point on the edge of a shape, it is better to make the connector terminate on a very small transparent port shape that has a fixed position on its parent shape.

Examples

// Make sure that connection points are used:
public override bool HasConnectionPoints { get { return true; } }

// A connection point in the middle of each edge.
public override void EnsureConnectionPoints(LinkShape link)
{
  RectangleD absoluteBoundingBox = this.AbsoluteBoundingBox;
  CreateConnectionPoint(new PointD(absoluteBoundingBox.Center.X, absoluteBoundingBox.Bottom));
  CreateConnectionPoint(new PointD(absoluteBoundingBox.Center.X, absoluteBoundingBox.Top));
  CreateConnectionPoint(new PointD(absoluteBoundingBox.Left, absoluteBoundingBox.Center.Y));
  CreateConnectionPoint(new PointD(absoluteBoundingBox.Right, absoluteBoundingBox.Center.Y));
    }
}

.NET Framework Security

See Also

Reference

NodeShape Class

Microsoft.VisualStudio.Modeling.Diagrams Namespace

CreateConnectionPoint(PointD)

ConnectionPoints

HasConnectionPoints