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


ControlsEditingSnapEdgeCommand CoClass (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Controls)  

ControlsEditingSnapEdgeCommand CoClass

Snap to an edge.

Product Availability

Available with ArcGIS Engine.

Description

The CLSID of this command is: {5D67D843-E10C-4D0B-A69C-2DFA82B25450}.

This command works with the ToolbarControl, PageLayoutControl, and MapControl.

If the ArcGIS Engine application using this command is initialized with an ArcGIS Engine Runtime license or an ArcGIS for Desktop Basic license, this command can be used to edit shapefiles and personal geodatabases.

If the ArcGIS Engine application using this command is initialized with an ArcGIS Engine GeoDatabase Editing license, or ArcGIS for Desktop Standard or ArcGIS for Desktop Advanced, this command can be used to edit data within an enterprise geodatabase.

Interfaces

Interfaces Description
ICommand (esriSystemUI) Provides access to members that define a COM command.

Remarks

This command can only be used from a pop up menu or context menu. Create a new ToolbarMenu and add this command or the predefined ControlsEditingSketchContextMenu to it using the IToolbarMenu::AddItem method. To display the ToolbarMenu as a right click context menu use the IToolbarMenu::PopupMenu method.

 

Note: the command does not have a bitmap.

[C#]
private IToolbarMenu m_ToolbarMenu;

private void Form1_Load(object sender, System.EventArgs e)
{
    //Create a new ToolbarMenu
    m_ToolbarMenu=new ToolbarMenu();

    //Share the ToolbarControl's command pool
    m_ToolbarMenu.CommandPool=axToolbarControl1.CommandPool;

    //Set the hook to the MapControl
    m_ToolbarMenu.SetHook(axMapControl1);

    //Add commands to the ToolbarMenu
    m_ToolbarMenu.AddItem("esriControls.ControlsEditingSketchContextMenu", 0, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
}

private void axMapControl1_OnMouseUp(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseUpEvent e)
{
    if (e.button  == 2) m_ToolbarMenu.PopupMenu(e.x, e.y, axMapControl1.hWnd);
}
[Visual Basic .NET]

Private m_ToolbarMenu As IToolbarMenu

Private Sub Form_Load()

  'Create a new ToolbarMenu
   m_ToolbarMenu=New ToolbarMenu

  'Share the ToolbarControl's command pool
   m_ToolbarMenu.CommandPool=AxToolbarControl1.CommandPool

  'Set the hook to the MapControl
   m_ToolbarMenu.SetHook(AxMapControl1)

  'Add commands to the ToolbarMenu
   m_ToolbarMenu.AddItem("esriControls.ControlsEditingSketchContextMenu", 0, 0, false, esriCommandStyles.esriCommandStyleTextOnly)

End Sub

Private Sub AxMapControl1_OnMouseUp(ByVal sender As System.Object, ByVal e As ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseUpEvent) Handles AxMapControl1.OnMouseUp


  If (e.button=2) Then m_ToolbarMenu.PopupMenu(e.x, e.y, AxMapControl1.hWnd)

End Sub