GefObject.ZOrderPosition (property)

Gets and sets the z-order of the object.
Syntax: long = object.ZOrderPosition
object.ZOrderPosition = long
Description: For GefObject, it returns the current z-order of the object. Setting it will change the object's z-order.

Objects in the GefObjects collections are ordered by z-order. collection.Item(0) is the bottom-most object and collection.Item(collection.Count-1) is the top-most object.

This property is calculated, not stored. In a container with many objects it can take a significant amount of time to calculate the z-order position.


Sub GefObject_ZOrderPosition()
    Dim oCimObjs As GefObjects
    Dim nObjCount, nI As Integer
    Set oCimObjs = CimGetScreen.object.Objects
    nObjCount = oCimObjs.Count
    For nI = 0 To nObjCount - 1
        MsgBox "Object " & nI + 1 & " has a z-order positon " & _
            "of " & oCimObjs.Item(nI).ZOrderPosition
    Next nI
End Sub