private void button1_Click(object sender, EventArgs e) { IHookHelper hookHelper = new HookHelperClass(); //hookHelper.Hook = axMapControl1.Object; hookHelper.Hook = m_controlsSynchronizer.MapControl.Object; poverView = new EagleEyes(hookHelper); poverView.Show(); }
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_pageLayoutControl = (IPageLayoutControl3)axPageLayoutControl1.Object; //Initialize controls synchronization calss m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl); //Bind MapControl and PageLayoutControl(Point to the same Map), Set MapControl as the active Control m_controlsSynchronizer.BindControls(true); //In order to switch MapControl and PageLayoutControl, we need to add Framework Control m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object); m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl1.Object); IHookHelper hookHelper = new HookHelperClass(); //hookHelper.Hook = axMapControl1.Object; hookHelper.Hook = m_controlsSynchronizer.MapControl.Object; poverView = new EagleEyes(hookHelper); OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer); axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly); m_TocLayerMenu.AddItem(new OpenAttributeTableCmd(), 0, 0, false, esriCommandStyles.esriCommandStyleIconAndText); m_TocLayerMenu.AddItem(new RemoveLayerCmd(), 0, 1, false, esriCommandStyles.esriCommandStyleIconAndText); m_TocLayerMenu.SetHook(axMapControl1); m_TocMapMenu.AddItem(new ControlsAddDataCommandClass(), 0, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_TocMapMenu.AddItem(new TurnAllLayersOnCmd(), 0, -1, true, esriCommandStyles.esriCommandStyleIconAndText); m_TocMapMenu.AddItem(new TurnAllLayersOffCmd(), 0, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_TocMapMenu.SetHook(axMapControl1); m_toolbarMenu.AddItem(new ClearCurrentTool(), 0, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new ClearFeatureSelection(), 0, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.AddItem(new Refresh(), 0, -1, false, esriCommandStyles.esriCommandStyleIconAndText); m_toolbarMenu.SetHook(axMapControl1); }