GlueToPos Method [Visio 2003 SDK Documentation]

Glues one shape to another from a cell in the first shape to an x,y position in the second shape.

object**.GlueToPos**shpObject, x, y

object     Required. An expression that returns a Cell object.

shpObject     Required object. An expression that returns the Shape object to be glued to.

x     Required Double. The x-coordinate of the position to glue to.

y     Required Double. The y-coordinate of the position to glue to.

Version added

2.0

Remarks

The GlueToPos method creates a new connection point at the location determined by x and y, which represent decimal fractions of the specified shape's width and height, respectively, rather than coordinates. For example, the following creates a connection point at the center of shpObject and glues the part of the shape that cellObject represents to that point:

cellObject.GlueToPosshpObject, 0.5, 0.5

Gluing the X cell of a Controls section row or a BeginX or EndX cell automatically glues the Y cell of the Controls section row or the BeginY or EndY cell, respectively. (The reverse is also true.)

Example

The following example shows how to use the GlueToPos method to glue shapes together.

Public Sub GlueToPos_Example() 

    Dim vso1DShape As Visio.Shape 
    Dim vso2DShape1 As Visio.Shape 
    Dim vso2DShape2 As Visio.Shape 
    Dim vsoCellGlueFromBegin As Visio.Cell 
    Dim vsoCellGlueFromEnd As Visio.Cell 

    'Draw a line. 
    Set vso1DShape = ActivePage.DrawLine(3, 5, 5, 3) 

    'Draw the lower rectangle. 
    Set vso2DShape1 = ActivePage.DrawRectangle(1, 1, 4, 2) 

    'Draw the upper rectangle. 
    Set vso2DShape2 = ActivePage.DrawRectangle(5, 5, 8, 6) 

    'Get the Cell objects needed to make the connections. 
    Set vsoCellGlueFromBegin = vso1DShape.Cells("BeginX") 
    Set vsoCellGlueFromEnd = vso1DShape.Cells("EndX") 

    'Use the GlueToPos method to glue the begin point of the 1-D shape 
    'to the top center of the lower 2-D shape. 
    vsoCellGlueFromBegin.GlueToPos vso2DShape1, 0.5, 1 

    'Use the GlueToPos method to glue the end point of the 1-D shape 
    'to the bottom center of the upper 2-D shape. 
    vsoCellGlueFromEnd.GlueToPos vso2DShape2, 0.5, 0 

End Sub  

Applies to | Cell object

See Also | FromCell property | ToSheet property