Shape.SpatialRelation 속성은 두 도형이 접촉했는지 여부를 알려줍니다. Shape.Index 속성은 z 순서에서 앞에 또는 뒤에있는 것을 알려줍니다.
Public Sub DoShapesIntersect(ByRef shape1 As Visio.Shape, ByRef shape2 As Visio.Shape)
'// do they touch?
If (shape1.SpatialRelation(shape2, 0, 0) <> 0) Then
'// they touch, which one is in front?
If (shape1.Index > shape2.Index) Then
Debug.Print shape1.Name + " is in front of " + shape2.Name
Else
Debug.Print shape1.Name + " is behind " + shape2.Name
End If
Else
Debug.Print "shape1 and shape2 do not touch"
End If
End Sub
읽기 자세한 내용은 여기 :
Shape.SpatialRelation Property on MSDN
다음
은 간단한 예입니다