Table of contents
TOC
折叠目录
展开目录

Shape.ConnectionSiteCount 属性 (发布服务器)Shape.ConnectionSiteCount Property (Publisher)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

返回一个Long ,该值指示当前图形对象上的连接结点的数目。只读的。Returns a Long indicating the count of connection sites on the current Shape object. Read-only.

语法Syntax

表达式ConnectionSiteCountexpression. ConnectionSiteCount

表示形状对象的 _expression_A 变量。_expression_A variable that represents a Shape object.

注解Remarks

连接位置的数量根据形状的几何形状而变化。矩形对象(包括表格和 Web 控件)一般具有四个连接位置,在其每个边缘的中点各有一个。The number of connection sites varies depending on the shape geometry. Rectangular objects including tables and Web controls will most likely have four connection sites, one centered on each edge of the shape.

示例Example

以下示例将两个矩形添加到当前出版物,并用两个连接符将其连接。两个连接符的起点都连接到第一个矩形的第一个连接位置,两个连接符的终点分别连接到第二个矩形的第一个和最后一个连接位置。然后计算第一个矩形上的连接数量。This example adds two rectangles to the active publication and joins them with two connectors. The beginnings of both connectors attach to connection site one on the first rectangle; the ends of the connectors attach to the first and last connection sites of the second rectangle. Then it counts the number of connections on the first rectangle.

Sub Connections() 

 Dim shpNew As Shapes 
 Dim shpFirstRect As Shape 
 Dim shpSecondRect As Shape 
 Dim intLastSite As Integer 
 Dim intCount As Integer 

 Set shpNew = Application.ActiveDocument _ 
 .MasterPages(Item:=1).Shapes 
 Set shpFirstRect = shpNew.AddShape(Type:=msoShapeRectangle, _ 
 Left:=100, Top:=50, Width:=200, Height:=100) 
 Set shpSecondRect = shpNew.AddShape(msoShapeRectangle, _ 
 Left:=300, Top:=300, Width:=200, Height:=100) 
 varLastSite = shpSecondRect.ConnectionSiteCount 

 ' Add the first connector from rectangle 1, 
 ' site 1 to rectangle 2, site 1. 
 With shpNew.AddConnector(Type:=msoConnectorCurve, _ 
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _ 
 .ConnectorFormat 
 .BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1 
 .EndConnect ConnectedShape:=shpSecondRect, ConnectionSite:=1 
 End With 

 ' Add the second connector from rectangle 1, 
 ' site 1 to rectangle 2, site 2. 
 With shpNew.AddConnector(Type:=msoConnectorCurve, _ 
 BeginX:=0, BeginY:=0, EndX:=100, EndY:=100) _ 
 .ConnectorFormat 
 .BeginConnect ConnectedShape:=shpFirstRect, ConnectionSite:=1 
 .EndConnect ConnectedShape:=shpSecondRect, _ 
 ConnectionSite:=intLastSite 
 End With 

 intCount = shpFirstRect.ConnectionSiteCount 

End Sub
© 2018 Microsoft