vba - Visio VBA - 连接到标注的线路
问题描述
我有一个标注触及 Visio 2013 中的一条线。
我发觉到:
- 我在 GluedShapes 中看不到它
- 我无法将连接器点添加到线(我认为这会触发 GluedShapes)
这是我用来查找它的代码。
For Each shp In Visio.ActivePage.Shapes
conn = shp.Name
aryTargetIDs = shp.GluedShapes(visGluedShapesAll1D, "")
For i = 0 To UBound(aryTargetIDs)
Set targetShape = Visio.ActivePage.Shapes.ItemFromID(aryTargetIDs(i))
Tgt = targetShape.Text
Debug.Print "1D glue " & conn & "|" & Tgt
Next i
Next shp
任何想法如何找到“连接”?也许试图遍历在标注结束下传播的任何内容..
解决方案
好的,我觉得这有点笨拙,但它似乎是这样做的方法.. 基本上是从SpatialRelationship 属性和选定的形状工作
这是我的代码
Dim intTolerance As Integer
Dim intReturnValue As VisSpatialRelationCodes
Dim intFlag As VisSpatialRelationFlags
Dim strReturn As String
Set sel = ActiveWindow.Selection
For Each shp In sel
conn = shp.Name
'Initialize tolerance argument.
intTolerance = 0.25
'Initialize flags argument.
intFlag = visSpatialIncludeHidden
For Each vsoShapeOnPage In ActivePage.Shapes
'Get the spatial relationship.
intReturnValue = shp.SpatialRelation(vsoShapeOnPage, _
intTolerance, intFlag)
'Convert return code to string value.
Select Case intReturnValue
Case VisSpatialRelationCodes.visSpatialContain
'strReturn = "Contains"
Case VisSpatialRelationCodes.visSpatialContainedIn
'strReturn = "is Contained in"
Case VisSpatialRelationCodes.visSpatialOverlap
'strReturn = "overlaps"
Case VisSpatialRelationCodes.visSpatialTouching
strReturn = "is touching"
Case Else
'strReturn = "has no relation with"
End Select
'Display relationship in the shape's text.
vsoShapeOnPage.Text = shp.Name & " " & strReturn & " " & vsoShapeOnPage.Name
Next
Next shp
End Sub
推荐阅读
- android - 如何从 Android Studio 中完全删除 Android 布局
- javascript - javascript读取.ini文件
- typescript - 开玩笑测试中的错误:TypeError:无法读取未定义的属性“容器”
- php - 标题和网站图标在 PHP 中不显示
- excel - 使用 Excel 宏在网站上搜索 Word 是否存在
- android - Appium/Python/Android:activate_app 命令在真实设备上无法正常工作,但在 AVD 上工作正常
- go - 如何使用 Golang 包获取 Dispart 详细信息(磁盘名(例如:磁盘 0)免费和磁盘使用情况)
- go - 为什么当 annoymouse 函数返回时 defer 语句的工作方式不同
- python - Python - 为绘图构建数据框
- google-cloud-platform - 双引号字符串数据在谷歌存储上以三引号显示