/// <summary> /// ToolbarMenu实例化和添加工具/命令按钮 /// </summary> public void SetHook(object hook) { m_toolbarMenu = new ToolbarMenuClass(); m_toolbarMenu.SetHook(hook); //添加工具/命令 m_toolbarMenu.AddItem(new LayerVisibility(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new LayerVisibility(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); AddItem("esriControls.ControlsAddDataCommand", -1); }
/// <summary> /// class constructor /// </summary> /// <param name="hook"></param> public TocMapContextMenu(object hook) { //Add custom commands to the map menu m_menu = new ToolbarMenuClass(); m_menu.AddItem(new LayerVisibility(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerVisibility(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.SetHook(hook); }
/// <summary> /// ToolbarMenuʵ��������ӹ���/���ť /// </summary> public void SetHook(object hook) { m_toolbarMenu = new ToolbarMenuClass(); m_toolbarMenu.SetHook(hook); //��ӹ���/���� m_toolbarMenu.AddItem(new LayerVisibility(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new LayerVisibility(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); AddItem("esriControls.ControlsAddDataCommand", -1); }
/// <summary> /// ToolbarMenu实例化和添加工具/命令按钮 /// </summary> public void SetHook(object hook) { m_toolbarMenu = new ToolbarMenuClass(); m_toolbarMenu.SetHook(hook); //添加工具/命令 //m_toolbarMenu.AddItem(new RemoveLayer(), -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); //m_toolbarMenu.AddItem(new LayerSelectable(), 1, 0, true, esriCommandStyles.esriCommandStyleTextOnly); //m_toolbarMenu.AddItem(new LayerSelectable(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new LayerVisible(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new LayerVisible(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new ZoomToLayer(), -1, 2, true, esriCommandStyles.esriCommandStyleTextOnly); }
/// <summary> /// ToolbarMenuʵ��������ӹ���/���ť /// </summary> public void SetHook(object hook) { m_toolbarMenu = new ToolbarMenuClass(); m_toolbarMenu.SetHook(hook); //��ӹ���/���� //m_toolbarMenu.AddItem(new RemoveLayer(), -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); //m_toolbarMenu.AddItem(new LayerSelectable(), 1, 0, true, esriCommandStyles.esriCommandStyleTextOnly); //m_toolbarMenu.AddItem(new LayerSelectable(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new LayerVisible(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new LayerVisible(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); m_toolbarMenu.AddItem(new ZoomToLayer(), -1, 2, true, esriCommandStyles.esriCommandStyleTextOnly); }
/// <summary> /// ToolbarMenuʵ��������ӹ���/���ť /// </summary> public void SetHook(object hook) { //#region ϵͳ�Ҽ����ܲ˵� //IToolbarMenu toolmenu = new ToolbarMenuClass(); //�Ҽ��˵� //toolmenu.AddItem(new MenuCommand.CommandZoomIn(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandZoomOut(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandPan(), -1, toolmenu.Count, true, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandExtent(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandMouseSelect(), -1, toolmenu.Count, true, esriCommandStyles.esriCommandStyleTextOnly); ////toolmenu.AddItem(new MenuCommand.CommandRectanleSelect(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandMeasureLength(), -1, toolmenu.Count, true, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandMeasureArea(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //#endregion m_toolbarMenu = new ToolbarMenuClass(); m_toolbarMenu.SetHook(hook); //��ӹ���/���� //AddItem("esriControls.ControlsMapZoomOutFixedCommand", -1); //AddItem("esriControls.ControlsMapZoomInFixedCommand", -1); m_toolbarMenu.AddItem(new GIS.View.ZoomInTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.ZoomOutTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.PanTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.RefreshViewCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.FullExtentTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); BeginGroup(); m_toolbarMenu.AddItem(new GIS.GraphicEdit.FeatureSelect(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.GraphicModify.EditCopyCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.GraphicModify.EditCutCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.GraphicModify.EditPasteCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); //BeginGroup(); //AddItem("GIS.View.ZoomInTool",-1); //AddItem("GIS.View.ZoomOutTool", -1); //AddItem("GIS.View.PanTool", -1); //AddItem("GIS.View.RefreshViewCommand", -1); //AddItem("GIS.View.FullExtentCommand", -1); //BeginGroup(); //�ָ��� ////AddItem("{380FB31E-6C24-4F5C-B1DF-47F33586B885}", -1); //���� ////AddItem(new Guid("B0675372-0271-4680-9A2C-269B3F0C01E8"), -1); //���� //AddItem("GIS.GraphicEdit.UndoEdit",-1); //AddItem("GIS.GraphicEdit.RedoEdit",-1); //BeginGroup(); ////AddItem("esriControls.ControlsEditingCopyCommand", -1); ////AddItem("esriControls.ControlsEditingPasteCommand", -1); ////AddItem("esriControls.ControlsEditingCutCommand", -1); //AddItem("GIS.GraphicModify.EditCopyCommand", -1); //AddItem("GIS.GraphicModify.EditCutCommand", -1); //AddItem("GIS.GraphicModify.EditPasteCommand", -1); }
/// <summary> /// ToolbarMenu实例化和添加工具/命令按钮 /// </summary> public void SetHook(object hook) { //#region 系统右键功能菜单 //IToolbarMenu toolmenu = new ToolbarMenuClass(); //右键菜单 //toolmenu.AddItem(new MenuCommand.CommandZoomIn(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandZoomOut(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandPan(), -1, toolmenu.Count, true, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandExtent(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandMouseSelect(), -1, toolmenu.Count, true, esriCommandStyles.esriCommandStyleTextOnly); ////toolmenu.AddItem(new MenuCommand.CommandRectanleSelect(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandMeasureLength(), -1, toolmenu.Count, true, esriCommandStyles.esriCommandStyleTextOnly); //toolmenu.AddItem(new MenuCommand.CommandMeasureArea(), -1, toolmenu.Count, false, esriCommandStyles.esriCommandStyleTextOnly); //#endregion m_toolbarMenu = new ToolbarMenuClass(); m_toolbarMenu.SetHook(hook); //添加工具/命令 //AddItem("esriControls.ControlsMapZoomOutFixedCommand", -1); //AddItem("esriControls.ControlsMapZoomInFixedCommand", -1); m_toolbarMenu.AddItem(new GIS.View.ZoomInTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.ZoomOutTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.PanTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.RefreshViewCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.View.FullExtentTool(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); BeginGroup(); m_toolbarMenu.AddItem(new GIS.GraphicEdit.FeatureSelect(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.GraphicModify.EditCopyCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.GraphicModify.EditCutCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new GIS.GraphicModify.EditPasteCommand(), -1, m_toolbarMenu.Count, false, esriCommandStyles.esriCommandStyleIconAndText); //BeginGroup(); //AddItem("GIS.View.ZoomInTool",-1); //AddItem("GIS.View.ZoomOutTool", -1); //AddItem("GIS.View.PanTool", -1); //AddItem("GIS.View.RefreshViewCommand", -1); //AddItem("GIS.View.FullExtentCommand", -1); //BeginGroup(); //分隔条 ////AddItem("{380FB31E-6C24-4F5C-B1DF-47F33586B885}", -1); //撤销 ////AddItem(new Guid("B0675372-0271-4680-9A2C-269B3F0C01E8"), -1); //重做 //AddItem("GIS.GraphicEdit.UndoEdit",-1); //AddItem("GIS.GraphicEdit.RedoEdit",-1); //BeginGroup(); ////AddItem("esriControls.ControlsEditingCopyCommand", -1); ////AddItem("esriControls.ControlsEditingPasteCommand", -1); ////AddItem("esriControls.ControlsEditingCutCommand", -1); //AddItem("GIS.GraphicModify.EditCopyCommand", -1); //AddItem("GIS.GraphicModify.EditCutCommand", -1); //AddItem("GIS.GraphicModify.EditPasteCommand", -1); }
/// <summary> /// class constructor /// </summary> /// <param name="hook"></param> public TocLayerContextMenu(object hook) { int index = 0; m_menu = new ToolbarMenuClass(); m_menu.AddItem(new LayerThresholds(), 1, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerThresholds(), 2, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerThresholds(), 3, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerSelectable(), 1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerSelectable(), 2, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerZoomTo() ,-1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerAnnotation(), 1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerAnnotation(), 2, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new LayerColor(), -1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); //m_menu.AddItem(new LayerProperty(), -1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); //Set the hook of each menu m_menu.SetHook(hook); }
/// <summary> /// class constructor /// </summary> /// <param name="hook"></param> public MapControlContextMenu(object hook) { int index = 0; m_menu = new ToolbarMenuClass(); m_menu.AddItem(new MapZoomin(), -1, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new MapZoomout(), -1, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new MapZoominFixed(), -1, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new MapZoomoutFixed(), -1, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new MapZoompan(), -1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new MapZoomToLastExtentBack(), -1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new MapZoomToLastExtentFoward(), -1, index++, false, esriCommandStyles.esriCommandStyleTextOnly); m_menu.AddItem(new MapZoomfullextent(), -1, index++, true, esriCommandStyles.esriCommandStyleTextOnly); //Set the hook of each menu m_menu.SetHook(hook); }
private void MainForm_Load(object sender, EventArgs e) { //get the MapControl m_mapControl = (IMapControl3)axMapControl1.Object; //disable the Save menu (since there is no document yet) menuSaveDoc.Enabled = false; m_MenuTOC = new ToolbarMenuClass(); //添加自定义菜单项到TOCCOntrol的图层菜单中 m_MenuLayer = new ToolbarMenuClass(); m_TOCControl = (ITOCControl2)this.axTOCControl1.Object; m_MenuLayer.AddItem(new OpenAttributeTb(axMapControl1), -1, 0, true, esriCommandStyles.esriCommandStyleTextOnly); m_MenuLayer.SetHook(m_mapControl); m_MenuTOC.SetHook(m_mapControl); }
/// <summary> /// Add a command item to the command bar by an Unique Identifier Object (UID). /// </summary> private void AddItem(UID itemUID) { m_toolbarMenu.AddItem(itemUID.Value, itemUID.SubType, -1, m_beginGroupFlag, esriCommandStyles.esriCommandStyleIconAndText); m_beginGroupFlag = false; //Reset group flag }