Blog
157   0

Create Menu in ArcMap Using ArcObject.

By Yogesh Sharma Blogs | ArcObject Dec 07, 2012
Create Menu in ArcMap Using ArcObject.
Create Menu in ArcMap Using ArcObject.

1. Add IRootLevelMenu in inherited interface. 

public sealed class MenuSoilInfo :ESRI.ArcGIS.ADF.BaseClasses.BaseMenu,ESRI.ArcGIS.Framework.IRootLevelMenu
{

}

2. we already created some tools in arcmap.
for example progId of these tools are-

"Tool_WaterQualityMaps.ToolWaterQualityMaps"
"Tool_SoilQualityMaps.ToolSoilQualityMaps"

we can also add GUID of Tools.

3.Then we add these items in following manner.


            AddItem("Tool_WaterQualityMaps.ToolWaterQualityMaps"); 

            //Tool_SoilQualityMaps
            //AddItem("{6b024347-d2d5-4d99-bfe0-c01bcc3b2484}", 1);
            AddItem("Tool_SoilQualityMaps.ToolSoilQualityMaps"); 

            //Tool_SingleStrataMaps
            //AddItem("{9d9cb4e2-442e-44cb-8c66-829e559f5f5a}", 1);
            AddItem("Tool_SingleStrataMaps.ToolSingleStrataMaps"); 


            //Tool_GeotechnicalParameterMaps
            //AddItem("{c9e8366b-0ec3-4410-9074-9b92910af451}", 1);
            AddItem("Tool_GeotechnicalParameterMaps.ToolGeotechnicalParameterMaps"); 


            //Tool_WaterLevelMaps
            //AddItem("{621ef33d-98da-4616-8d61-ca9d3161dee7}", 1);
            AddItem("Tool_WaterLevelMaps.ToolWaterLevelMaps");

            AddItem("Tool_OpenMapPdf.ToolOpenPdf");

            AddItem("configArcTool.ToolConfigArcMap");


4. Complete Module -

public MenuSoilInfo()
        {
            
            AddItem("Tool_WaterQualityMaps.ToolWaterQualityMaps"); // command

            //Tool_SoilQualityMaps
            //AddItem("{6b024347-d2d5-4d99-bfe0-c01bcc3b2484}", 1);
            AddItem("Tool_SoilQualityMaps.ToolSoilQualityMaps"); // command

            //Tool_SingleStrataMaps
            //AddItem("{9d9cb4e2-442e-44cb-8c66-829e559f5f5a}", 1);
            AddItem("Tool_SingleStrataMaps.ToolSingleStrataMaps"); // command


            //Tool_GeotechnicalParameterMaps
            //AddItem("{c9e8366b-0ec3-4410-9074-9b92910af451}", 1);
            AddItem("Tool_GeotechnicalParameterMaps.ToolGeotechnicalParameterMaps"); // command


            //Tool_WaterLevelMaps
            //AddItem("{621ef33d-98da-4616-8d61-ca9d3161dee7}", 1);
            AddItem("Tool_WaterLevelMaps.ToolWaterLevelMaps"); // command

            AddItem("Tool_OpenMapPdf.ToolOpenPdf"); // command

            AddItem("configArcTool.ToolConfigArcMap"); // command
            
            //AddItem(new Guid("FBF8C3FB-0480-11D2-8D21-080009EE4E51"), 2); //redo command
        }





we can also add these tools in Group manner or sub menu.I expain these in my next blog.
COMMENT USING