ZOrder method

Moves the specified shape in front of or behind other shapes in the Shapes collection or roads on the map; similar to using the Draw menu entries on the Drawing toolbar.

Applies to

Objects:  Shape

Syntax

object.ZOrder(ZOrderCmd)

Parameters

Part Description
object Required. An expression that returns a Shape object.
ZOrderCmd Required GeoZOrderCmd. Indicates where to move the specified shape relative to other shapes in the collection, and to roads on the map.
GeoZOrderCmd Value Description
geoBringForward
2
Moves the shape up, or forward, one position in the order
geoBringInFrontOfRoads
4
Moves the shape on top of roads
geoBringToFront
0
Moves the shape to the first position in the order
geoSendBackward
3
Moves the shape down, or back, one position in the order
geoSendBehindRoads
5
Moves the shape behind roads
geoSendToBack
1
Moves the shape to the last position in the order

Remarks

To return the position of a shape within a Shapes collection, use the ZOrderPosition property of the Shape object.

Example

    Sub BringRectangleForward()

  Dim objApp As New MapPoint.Application   Dim objMap As MapPoint.Map   Dim objLoc As MapPoint.Location
  'Set up application and get a location object   Set objMap = objApp.ActiveMap   objApp.Visible = True   objApp.UserControl = True   Set objLoc = objApp.ActiveMap.GetLocation(0, 0)
  'Create two shapes at this location and zoom to this location   Set objMap.Location = objLoc   objMap.Shapes.AddShape geoShapeRectangle, objLoc, 20, 30   objMap.Shapes.AddShape geoShapeRadius, objLoc, 30, 40
  'Change the rectangle color, then bring it to the front   objMap.Shapes.Item(1).Line.ForeColor = vbBlue   objMap.Shapes.Item(1).ZOrder geoBringForward
  End Sub