private void Form1_Load(object sender, System.EventArgs e) { //Set buddy control axToolbarControl1.SetBuddyControl(axPageLayoutControl1); axTOCControl1.SetBuddyControl(axPageLayoutControl1); //Add ToolbarControl items axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomInTool", 0, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomOutTool", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomWholePageCommand", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapZoomInTool", 0, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapZoomOutTool", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapPanTool", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapFullExtentCommand", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsSelectTool", 0, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); //Create a new ToolbarPalette IToolbarPalette toolbarPalette = new ToolbarPalette(); toolbarPalette.Caption = "Map Surrounds"; toolbarPalette.AddItem(new CreateNorthArrow(), -1, -1); toolbarPalette.AddItem(new CreateScaleBar(), -1, -1); toolbarPalette.AddItem(new CreateScaleText(), -1, -1); //Add the ToolbarPalette to the ToolbarControl axToolbarControl1.AddItem(toolbarPalette, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); }
private void MainForm_Load(object sender, EventArgs e) { //get the MapControl m_mapControl = (IMapControl3)axMapControl1.Object; this.WindowState = FormWindowState.Maximized; axTOCControl1.SetBuddyControl(axMapControl1); axToolbarControl1.SetBuddyControl(axMapControl1); //disable the Save menu (since there is no document yet) menuSaveDoc.Enabled = false; //Add ToolbarControl items axToolbarControl3.AddItem("esriControls.ControlsOpenDocCommand", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsPageZoomInTool", 0, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsPageZoomOutTool", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsPageZoomWholePageCommand", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsMapZoomInTool", 0, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsMapZoomOutTool", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsMapPanTool", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsMapFullExtentCommand", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl3.AddItem("esriControls.ControlsSelectTool", 0, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); //Create a new ToolbarPalette IToolbarPalette toolbarPalette = new ToolbarPalette(); toolbarPalette.Caption = "Map Surrounds"; toolbarPalette.AddItem(new CreateNorthArrow(), -1, -1); toolbarPalette.AddItem(new CreateScaleBar(), -1, -1); toolbarPalette.AddItem(new CreateScaleText(), -1, -1); //Add the ToolbarPalette to the ToolbarControl axToolbarControl3.AddItem(toolbarPalette, -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); }
private void Form1_Load(object sender, EventArgs e) { //Create the customize dialog for the ToolbarControl CreateCustomizeDialog(); //Create symbol used on the MapControl CreateOverviewSymbol(); //Set label editing to manual axTOCControl1.LabelEdit = esriTOCControlEdit.esriTOCControlManual; //Get file name used to persist the ToolbarControl if (System.IO.File.Exists(filenameforToolbar)) { LoadToolbarControlItems(filenameforToolbar); } else { //Add generic commands //axToolbarControl1.AddItem("esriControls.ControlsOpenDocCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsAddDataCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); //Add page layout navigation commands axToolbarControl1.AddItem("esriControls.ControlsPageZoomInTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomOutTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPagePanTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsPageZoomWholePageCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); //Add map navigation commands axToolbarControl1.AddItem("esriControls.ControlsMapZoomInTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapZoomOutTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapPanTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapFullExtentCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapZoomToLastExtentBackCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapZoomToLastExtentForwardCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); //Add map inquiry commands axToolbarControl1.AddItem("esriControls.ControlsMapIdentifyTool", -1, -1, true, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapFindCommand", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); axToolbarControl1.AddItem("esriControls.ControlsMapMeasureTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); //Add custom AddDateTool //axToolbarControl1.AddItem("Commands.AddDateTool", -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText); //Create a new ToolbarPalette IToolbarPalette toolbarPalette = new ToolbarPalette(); //Add commands and tools to the ToolbarPalette toolbarPalette.AddItem("esriControls.ControlsNewMarkerTool", -1, -1); toolbarPalette.AddItem("esriControls.ControlsNewLineTool", -1, -1); toolbarPalette.AddItem("esriControls.ControlsNewCircleTool", -1, -1); toolbarPalette.AddItem("esriControls.ControlsNewEllipseTool", -1, -1); toolbarPalette.AddItem("esriControls.ControlsNewRectangleTool", -1, -1); toolbarPalette.AddItem("esriControls.ControlsNewPolygonTool", -1, -1); //Add the ToolbarPalette to the ToolbarControl axToolbarControl1.AddItem(toolbarPalette, 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly); } //Create a new ToolbarMenu m_ToolbarMenu = new ToolbarMenu(); //Share the ToolbarControl's command pool m_ToolbarMenu.CommandPool = axToolbarControl1.CommandPool; //Set the hook to the PageLayoutControl m_ToolbarMenu.SetHook(axPageLayoutControl1); //Add commands to the ToolbarMenu m_ToolbarMenu.AddItem("esriControls.ControlsPageZoomInFixedCommand", -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_ToolbarMenu.AddItem("esriControls.ControlsPageZoomOutFixedCommand", -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_ToolbarMenu.AddItem("esriControls.ControlsPageZoomWholePageCommand", -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_ToolbarMenu.AddItem("esriControls.ControlsPageZoomPageToLastExtentBackCommand", -1, -1, true, esriCommandStyles.esriCommandStyleIconAndText); m_ToolbarMenu.AddItem("esriControls.ControlsPageZoomPageToLastExtentForwardCommand", -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText); //Set buddy controls axTOCControl1.SetBuddyControl(axPageLayoutControl1); axToolbarControl1.SetBuddyControl(axPageLayoutControl1); }