This document is archived and information here might be outdated.  Recommended version.


IMapLayers.InsertLayer Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Carto)  

IMapLayers.InsertLayer Method

Inserts a layer at the given position.

[Visual Basic .NET]
Public Sub InsertLayer ( _
    ByVal pLayer As ILayer, _
    ByVal autoArrange As Boolean, _
    ByVal position As Integer _
)
[C#]
public void InsertLayer (
    ILayer pLayer,
    bool autoArrange,
    int position
);
[C++]
HRESULT InsertLayer(
  ILayer* pLayer,
  VARIANT_BOOL autoArrange,
  long position
);
[C++]

Parameters pLayer [in]
pLayer is a parameter of type ILayer autoArrange [in] autoArrange is a parameter of type VARIANT_BOOL position [in] position is a parameter of type long

Product Availability

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

Remarks

The autoArrange parameter controls the ordering of the layers.  If autoArrange is set to TRUE, the layer is added in the proper position as by its weight specified via ILayerPosition::LayerWeight.  By default, this means that the layers are sorted by layer type - Annotation layers on top, followed by Point geometry layers, Polyline geometry layers, and at the bottom Polygon geometry layers.  If autoArrange is true for this method, the position passed in is ignored as the position is determined by the auto arrange logic.

See Also

IMapLayers Interface

.NET Samples

Add a traversal result to the map (Code Files: AddTraversalResultsToMap)