ArcObjects Library Reference  (Carto)    

IMap.MoveLayer Method

Moves a layer to another position.

[Visual Basic 6.0]
Sub MoveLayer(
    ByVal Layer As ILayer, _
    ByVal toIndex As Long _
)
[Visual Basic .NET]
Public Sub MoveLayer ( _
    ByVal Layer As ILayer, _
    ByVal toIndex As Integer _
)
[C#]
public void MoveLayer (
    ILayer Layer,
    int toIndex
);
[Java]
public void moveLayer (
    ILayer Layer,
    int toIndex
)
throws
    IOException,
    AutomationException
[C++]
HRESULT MoveLayer(
  ILayer* Layer,
  long toIndex
);
[C++]

Parameters

Layer [in]

  Layer is a parameter of type ILayer

toIndex [in]

  toIndex is a parameter of type long

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

The MoveLayer method moves the layer to the position specified by the 0-based index. If the index is invalid, the layer is moved to the bottom.
MoveLayer automatically updates the contents view (TOC) but it does not update the map.
 
[Visual Basic 6.0]
Public Sub MoveLayer()
    Dim pMxDocument As IMxDocument
    Dim pMap As IMap
    Dim pLayer As ILayer
    Set pMxDocument = Application.Document
    Set pMap = pMxDocument.FocusMap
    Set pLayer = pMxDocument.SelectedLayer
    pMap.MoveLayer pLayer, pMap.LayerCount - 1
End Sub

See Also

IMap Interface

 


Feedback Send feedback on this page