1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| 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)
'---> Il faut coller les Shape avec la methode GlueTo
' expression.GlueTo (CellObject)
' expression Variable qui représente un objet Cell
End If
Next
End If
'Display the results on the shape added.
vsoShapeAdded.Text = strSpatialRelation
End Sub |
Partager