我在连接一个实际连接到预定义连接点而不是仅连接到顶部的链接动态连接器时遇到了麻烦。
我的主人在左侧有一些文本框,在右侧有一些文本框。当我自动连接到那些文本框时,除了第一个和最后一个之外,它们都连接正常。它们不像其他人那样连接到侧面,而是连接到盒子中间的顶部和底部,这破坏了视觉效果。即使在侧面定义了连接点。
我一直在寻找使用Glue To手动连接到连接点,但我无法弄清楚如何解决连接点。
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
所以我的实际问题是如何连接到连接点而不是形状本身?
你可以粘上连接器的.Cells("BeginX")
或.Cells("EndX")
Shape.Cells("PinX")
Shape.CellsSRC(visSectionConnectionPts, row, column)
CellSRC
,请使用以0开头的行号
列号不相关,可以是0或1 = visCnnctX或visCnnctYCellSRC(7, 0, 0)
7 = visSectionConnectionPts,0 =第一个连接点,0Dim 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