我在连接一个链接的动态连接器时遇到了一些问题,它实际上连接到一个预定义的连接点,而不仅仅是连接到顶部。
我的主人在左边有一些文本框,在右边有一些。当我自动连接到这些文本框时,除了第一个和最后一个之外,它们都连接得很好。而不是像其他人那样连接到侧面,它们连接到盒子中间的顶部和底部,这会破坏视觉效果。即使在边上定义了连接点。
我一直在考虑使用GlueTo手动连接到连接点,但我不知道如何访问连接点。
Set vsoConnectorShape = ActiveDocument.Masters.ItemU("Dynamic connector")
Set BoxShape = ActivePage.Shapes(i)
Set DevShape = ActivePage.Shapes(j)
NewRow = DevShape.AddRow(visSectionConnectionPts, visRowLast, visTagDefault)
DevShape.CellsSRC(visSectionConnectionPts, NewRow, visX).Formula = "Width*0"
DevShape.CellsSRC(visSectionConnectionPts, NewRow, visY).Formula = "Height*0.5"
DevShape.AutoConnect BoxShape, visAutoConnectDirLeft, vsoConnectorShape
因此,我的实际问题是如何连接到连接点,而不是形状本身?
发布于 2019-03-04 23:43:51
您可以粘合连接器的.Cells("BeginX")
或.Cells("EndX")
连接到最近的形状连接符:
Shape.Cells("PinX")
Shape.CellsSRC(visSectionConnectionPts, row, column)
使用从0开始的行号表示CellSRC
列号不相关,可以是0或1= visCnnctX或visCnnctY
并在代码中搜索例如。
CellSRC(7, 0, 0)
7= visSectionConnectionPts,0=第一个连接点,0
Dim myConnector As Visio.Shape
' drop it somewhere
Set myConnector = ActiveWindow.Page.Drop(Application.ConnectorToolDataObject, 1, 10)
' connect it to the nearest connection point of a shape (varies if you drag)
myConnector.Cells("BeginX").GlueTo BoxShape.Cells("PinX")
' connect it a fixed connection point (example if shape has 4 points)
myconnector.Cells("BeginX").GlueTo _
Boxshape.CellsSRC(visSectionConnectionPts, 0, 0) ' left
' .CellsSRC(visSectionConnectionPts, 1, 0) ' right
' .CellsSRC(visSectionConnectionPts, 2, 0) ' top
' .CellsSRC(visSectionConnectionPts, 3, 0) ' bottom
https://stackoverflow.com/questions/54986245
复制相似问题