Poll
Question:
How use the GlueTo method (Two 2D shapes)
Option 1:
I have not option
votes: 1
Option 2:
I have not option
votes: 0
Hello world !
I need your brains to solve a small problem that I have encountered just recently. Indeed, I would like to know how to use the "GlueTo" method to glue two 2D shapes.
Public Sub Document_ShapeAdded (ByVal vsoShapeAdded As IVShape)
Dim vsoShapeOnPage As Visio.Shape
Dim vsoDocument As Visio.Document
Dim vsoPage As Visio.Page
Dim vsoReturnedSelection As Visio.Selection
Dim intSpatialRelation As VisSpatialRelationCodes
intSpatialRelation = visSpatialOverlap + visSpatialContainedIn
Set vsoReturnedSelection = vsoShapeAdded.SpatialNeighbors(intSpatialRelation, 0, 0)
'Evaluate the results.
If vsoReturnedSelection.Count = 0 Then
'Aucune forme satisfait aux critères établis par les arguments de la méthode.
strSpatialRelation = vsoShapeAdded.Name & " is not contained."
Else
'Build the positive result string.
For Each vsoShapeOnPage In vsoReturnedSelection
If vsoShapeOnPage.Name Like "Function*" And vsoShapeAdded.Name Like "port*" Then
strSpatialRelation = strSpatialRelation & vsoShapeAdded.Name & " is contained by " & vsoShapeOnPage.Name & Chr$(10)
'---> I've to use the GlueTo method
End If
Next
End If
'Display the results on the shape added.
vsoShapeAdded.Text = strSpatialRelation
End Sub
As you can see, my program is using the SpatialNeighbors property to find out if one shape is contained in another. if I have a Shape which is contained in an another Shape so I have to stick my shapes with the GlueTo method. But I have trouble using this method.
Here, My function is a Rectangle and my port is a group of Shape (Line + triangle)
So if you have a any solution or idea don't hesitate. Thank you