![]() |
This document is archived and information here might be outdated. Recommended version. |
Engine sketch context menu.
The CLSID of this menu is: {4F29BC92-2988-45E8-8317-0169EAB954C6}.
This menu works with the ToolbarControl, PageLayoutControl, and MapControl.
If the ArcGIS Engine application using this menu is initialized with an ArcGIS Engine Runtime license or an ArcGIS for Desktop Basic license, this menu can be used to edit shapefiles and personal geodatabases.
If the ArcGIS Engine application using this menu is initialized with an ArcGIS Engine GeoDatabase Editing license, or ArcGIS for Desktop Standard or ArcGIS for Desktop Advanced, this menu can be used to edit data within an enterprise geodatabase.
| Interfaces | Description |
|---|---|
| IMenuDef (esriSystemUI) | Provides access to members that define a menu. |
This menu can only be used as a pop up menu or context menu. Create a new ToolbarMenu and add this predefined ControlsEditingSketchContextMenu to it using the IToolbarMenu::AddItem method. To display the ToolbarMenu as a right click context menu use the IToolbarMenu::PopupMenu method.
To enable the accelerator keys on this context menu complete the following steps:
privateIToolbarMenu m_ToolbarMenu;private voidMainForm_Load(objectsender, EventArgs e) {//Create a new ToolbarMenum_ToolbarMenu =newToolbarMenu();//Share the ToolbarControl's command poolm_ToolbarMenu.CommandPool = axToolbarControl1.CommandPool;//Set the hook to the MapControlm_ToolbarMenu.SetHook(axMapControl1);//Add commands to the ToolbarMenum_ToolbarMenu.AddItem("esriControls.ControlsEditingSketchContextMenu", 0, 0,false, esriCommandStyles.esriCommandStyleTextOnly);//Create each command on the ToolbarMenu so that the Accelerator Keys are recognized.//Alternatively the user must popup the menu before using the Accelerator KeyslongitemCount = m_ToolbarMenu.CommandPool.Count;for(inti = 0; i < itemCount; i++) { ICommand pCommand = m_ToolbarMenu.CommandPool.get_Command(i); pCommand.OnCreate(m_mapControl); } }private voidMainForm_KeyDown(objectsender, KeyEventArgs e) { ICommandPool2 pPool2; pPool2 = m_ToolbarMenu.CommandPoolasICommandPool2; pPool2.TranslateAcceleratorKey((int)e.KeyCode); }private voidaxMapControl1_OnMouseUp(objectsender, IMapControlEvents2_OnMouseUpEvent e) {if(e.button == 2) m_ToolbarMenu.PopupMenu(e.x, e.y, axMapControl1.hWnd); }
Privatem_ToolbarMenuAsIToolbarMenuPrivate SubMainForm_Load(ByValsenderAsSystem.Object,ByValeAsEventArgs)HandlesMyBase.Load'get the MapControlm_mapControl =CType(axMapControl1.Object, IMapControl3)'disable the Save menu (since there is no document yet)menuSaveDoc.Enabled =False'Create a new ToolbarMenum_ToolbarMenu =NewToolbarMenu()'Share the ToolbarControl's command poolm_ToolbarMenu.CommandPool = axToolbarControl1.CommandPool'Set the hook to the MapControlm_ToolbarMenu.SetHook(axMapControl1)'Add commands to the ToolbarMenum_ToolbarMenu.AddItem("esriControls.ControlsEditingSketchContextMenu", 0, 0,False, esriCommandStyles.esriCommandStyleTextOnly)'Create each command on the ToolbarMenu so that the Accelerator Keys are recognized. Alternatively'the user must popup the menu before using the Accelerator KeysDimitemCountAs IntegeritemCount = m_ToolbarMenu.CommandPool.CountDimiAs Integer Fori = 0ToitemCount - 1DimpCommandAsICommand pCommand =CType(m_ToolbarMenu.CommandPool.Command(i), ICommand) pCommand.OnCreate(m_mapControl)Next End Sub Private SubaxMapControl1_OnMouseUp(ByValsenderAsSystem.Object,ByValeAsESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseUpEvent)HandlesaxMapControl1.OnMouseUpIf(e.button = 2)Thenm_ToolbarMenu.PopupMenu(e.x, e.y, axMapControl1.hWnd)End If End Sub Private SubMainForm_KeyDown(ByValsenderAsSystem.Object,ByValeAsSystem.Windows.Forms.KeyEventArgs)HandlesMyBase.KeyDownDimpPool2AsICommandPool2 pPool2 =CType(m_ToolbarMenu.CommandPool, ICommandPool2) pPool2.TranslateAcceleratorKey(e.KeyCode)EndSub