Visio) (Connect.FromPart 属性

返回生成连接的形状的部分。 此为只读属性。

语法

表达式FromPart

表达 一个代表 Connect 对象的变量。

返回值

整数

备注

下列由 Microsoft Visio 类型库声明的常量显示 FromPart 属性的返回值。

常量
visConnectFromError -1
visFromNone 0
visLeftEdge 1
visCenterEdge 2
visRightEdge 3
visBottomEdge 4
visMiddleEdge 5
visTopEdge 6
visBeginX 7
visBeginY 8
visBegin 9
visEndX 10
visEndY 11
visEnd 12
visFromAngle 13
visFromPin 14
visControlPoint 100 + 从零开始的行索引(例如,如果控制点在第 0 行,则 visControlPoint = 100;如果控制点在第 1 行,则 visControlPoint = 101)

示例

以下 Microsoft Visual Basic for Applications (VBA) 宏显示如何从 Visio 绘图中提取连接信息。 该示例在“立即”窗口中显示连接信息。

此示例假设存在一个至少包含两个已连接形状的活动文档。

 
Public Sub FromPart_Example() 
 
 Dim vsoShapes As Visio.Shapes 
 Dim vsoShape As Visio.Shape 
 Dim vsoConnectFrom As Visio.Shape 
 Dim intFromData As Integer 
 Dim strFrom As String 
 Dim vsoConnects As Visio.Connects 
 Dim vsoConnect As Visio.Connect 
 Dim intCurrentShapeIndex As Integer 
 Dim intCounter As Integer 
 Set vsoShapes = ActivePage.Shapes 
 
 'For each shape on the page, get its connections. 
 For intCurrentShapeIndex = 1 To vsoShapes.Count 
 Set vsoShape = vsoShapes(intCurrentShapeIndex) 
 Set vsoConnects = vsoShape.Connects 
 
 'For each connection, get the shape it originates from 
 'and the part of the shape it originates from, 
 'and print that information in the Immediate window. 
 For intCounter = 1 To vsoConnects.Count 
 Set vsoConnect = vsoConnects(intCounter) 
 Set vsoConnectFrom = vsoConnect.FromSheet 
 intFromData = vsoConnect.FromPart 
 
 'FromPart property values 
 If intFromData = visConnectError Then 
 strFrom = "error" 
 ElseIf intFromData = visNone Then 
 strFrom = "none" 
 ElseIf intFromData = visLeftEdge Then 
 strFrom = "left" 
 ElseIf intFromData = visCenterEdge Then 
 strFrom = "center" 
 ElseIf intFromData = visRightEdge Then 
 strFrom = "right" 
 ElseIf intFromData = visBottomEdge Then 
 strFrom = "bottom" 
 ElseIf intFromData = visMiddleEdge Then 
 strFrom = "middle" 
 ElseIf intFromData = visTopEdge Then 
 strFrom = "top" 
 ElseIf intFromData = visBeginX Then 
 strFrom = "beginX" 
 ElseIf intFromData = visBeginY Then 
 strFrom = "beginY" 
 ElseIf intFromData = visBegin Then 
 strFrom = "begin" 
 ElseIf intFromData = visEndX Then 
 strFrom = "endX" 
 ElseIf intFromData = visEndY Then 
 strFrom = "endY" 
 ElseIf intFromData = visEnd Then 
 strFrom = "end" 
 ElseIf intFromData >= visControlPoint Then 
 strFrom = "controlPt_" & _ 
 Str(intFromData - visControlPoint + 1) 
 Else 
 strFrom = "???" 
 End If 
 
 Debug.Print vsoConnectFrom.Name & " " & strFrom 
 
 Next intCounter 
 
 Next intCurrentShapeIndex 
 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。