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


IEditProperties.SnapSymbol Property (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Editor)  

IEditProperties.SnapSymbol Property

Symbol used to draw the snap location.

[Visual Basic .NET]
Public Property SnapSymbol As IMarkerSymbol
[C#]
public IMarkerSymbol SnapSymbol {get; set;}

Product Availability

Available with ArcGIS Desktop.

Remarks

Use this property to change the editor's snap symbol when classic snapping is enabled. The snap symbol is displayed whenever you are working with the edit sketch. The default snap symbol is a blue dot.

The snap agent knows to draw the snap symbol twice, once to get rid of the old symbol and once to draw the symbol at its new location. When setting the symbol, don't forget to set its ROP property (on the ISymbol interface) to esriROPNotXOrPen . This setting allows the symbol to erase itself when drawn twice in the same location.
[C#]
///

 /// This example below uses the OnCurrentLayerChanged edit event to change the editor's snap symbol. /// If the current layer has a geometry of type point, the editor uses it as its snap symbol. /// If the geometry is of type polygon or polyline, the editor uses the default symbol. /// Note: An UniqueValueRender must be used for the point layer. ///
public class SnapSymbol_Example
{
    private IEditor m_editor;
    private IEditEvents_Event m_editorEvents;
    private IEditProperties m_editProperties;
private IMarkerSymbol m_origsymbol; public SnapSymbol_Example(IEditor editor) { m_editor=editor; m_editorEvents=m_editor as IEditEvents_Event; m_editProperties=m_editor as IEditProperties;
m_origsymbol=m_editProperties.SnapSymbol;
//setup and register delegates IEditEvents_OnCurrentLayerChangedEventHandler editEvents_OnCurrentLayerChangedEventHandler=new IEditEvents_OnCurrentLayerChangedEventHandler(this.OnCurrentLayerChanged); m_editorEvents.OnCurrentLayerChanged += editEvents_OnCurrentLayerChangedEventHandler; } public void OnCurrentLayerChanged() { IEditLayers editLayers=m_editor as IEditLayers; //Check that the current layer contains point features if (editLayers.CurrentLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint) { IGeoFeatureLayer geoFeatureLayer=editLayers.CurrentLayer as IGeoFeatureLayer; IFeatureRenderer renderer=geoFeatureLayer.Renderer; renderer.ToString(); //Make sure that a uniquevalue renderer is being used to display the points ISymbol symbol=null; if (renderer is IUniqueValueRenderer) { //Check if data has subtypes ISubtypes layerSubTypes=editLayers.CurrentLayer.FeatureClass as ISubtypes; IUniqueValueRenderer uniqueValueRenderer=geoFeatureLayer.Renderer as IUniqueValueRenderer; if (layerSubTypes.HasSubtype) { int value=editLayers.CurrentSubtype; symbol=uniqueValueRenderer.get_Symbol(value.ToString()); } symbol=uniqueValueRenderer.DefaultSymbol; } if (symbol == null) { System.Windows.Forms.MessageBox.Show("Renderer must be UniqueValueRenderer"); return; } //Set the ROP property so the symbol will clear itself on redraw symbol.ROP2=esriRasterOpCode.esriROPNotXOrPen; m_editProperties.SnapSymbol=symbol as IMarkerSymbol; } else { System.Windows.Forms.MessageBox.Show("Layer must be polyline or polygon");
m_editProperties.SnapSymbol=m_origsymbol; } } }

See Also

IEditProperties Interface | IEditor.InvertAgent Method | IEditProperties.SelectedVertexSymbol Property | IEditProperties.SketchVertexSymbol Property