返回要建立连接的形状的部分。 此为只读属性。
语法
表达式。ToPart
表达 一个代表 Connect 对象的变量。
返回值
整数
备注
ToPart 属性标识某个形状中被另一个形状粘附的部分,例如其起点或终点、一条边或一个连接点。 由 Visio 类型库在 VisToParts 成员中声明的下列常量显示 ToPart 属性的可能的返回值。
常量 | 值 |
---|---|
visConnectToError | -1 |
visToNone | 0 |
visGuideX | 1 |
visGuideY | 2 |
visWholeShape | 3 |
visGuideIntersect | 4 |
visToAngle | 7 |
visConnectionPoint | 100 + 连接点的行索引 |
示例
以下 Microsoft Visual Basic for Applications (VBA) 宏显示如何从 Microsoft Visio 绘图中提取连接信息。 该示例在“立即”窗口中显示连接信息。
此示例假设存在一个至少包含两个已连接形状的活动文档。
Public Sub ToPart_Example()
Dim vsoShapes As Visio.Shapes
Dim vsoShape As Visio.Shape
Dim vsoConnectTo As Visio.Shape
Dim intToData As Integer
Dim strTo As String
Dim vsoConnects As Visio.Connects
Dim vsoConnect As Visio.Connect
Dim intCurrentShapeID As Integer
Dim intCounter As Integer
Set vsoShapes = ActivePage.Shapes
'For each shape on the page, get its connections.
For intCurrentShapeID = 1 To vsoShapes.Count
Set vsoShape = vsoShapes(intCurrentShapeID)
Set vsoConnects = vsoShape.Connects
'For each connection, get the shape it connects to
'and the part of the shape it connects to,
'and print that information in the Immediate window.
For intCounter = 1 To vsoConnects.Count
Set vsoConnect = vsoConnects(intCounter)
Set vsoConnectTo = vsoConnect.ToSheet
intToData = vsoConnect.ToPart
If intToData = visConnectError Then
strTo = "error"
ElseIf intToData = visNone Then
strTo = "none"
ElseIf intToData = visGuideX Then
strTo = "guideX"
ElseIf intToData = visGuideY Then
strTo = "guideY"
ElseIf intToData = visWholeShape Then
strTo = "dynamic glue"
ElseIf intToData >= visConnectionPoint Then
strTo = "connection point " & _
CStr(intToData - visConnectionPoint + 1)
Else
strTo = "???"
End If
'Print the name and part of the shape the
'Connect object connects to.
Debug.Print "To "; vsoConnectTo.Name & " " & strTo & "."
Next intCounter
Next intCurrentShapeID
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。