public BindControls ( IMapControl3 mapControl, IPageLayoutControl2 pageLayoutControl, bool activateMapFirst ) : void | ||
mapControl | IMapControl3 | |
pageLayoutControl | IPageLayoutControl2 | |
activateMapFirst | bool | true if the MapControl supposed to be activated first |
리턴 | void |
/// <summary> /// Form.Load method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, System.EventArgs e) { //get a reference to the MapControl and the PageLayoutControl m_mapControl = (IMapControl3)axMapControl1.Object; m_pageLayoutControl = (IPageLayoutControl2)axPageLayoutControl1.Object; //initialize the controls synchronization class m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl); //bind the controls together (both point at the same map) and set the MapControl as the active control m_controlsSynchronizer.BindControls(true); //add the framework controls (TOC and Toolbars) in order to synchronize then when the //active control changes (call SetBuddyControl) m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object); m_controlsSynchronizer.AddFrameworkControl(axToolbarControl2.Object); m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object); //add the Open Map Document command onto the toolbar OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer); axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly); }
/// <summary> /// Form.Load method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, System.EventArgs e) { //get a reference to the MapControl and the PageLayoutControl m_mapControl = (IMapControl3)axMapControl1.Object; m_pageLayoutControl = (IPageLayoutControl2)axPageLayoutControl1.Object; //initialize the controls synchronization class m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl); //bind the controls together (both point at the same map) and set the MapControl as the active control m_controlsSynchronizer.BindControls(true); //add the framework controls (TOC and Toolbars) in order to synchronize then when the //active control changes (call SetBuddyControl) m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object); m_controlsSynchronizer.AddFrameworkControl(axToolbarControl2.Object); m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object); //add the Open Map Document command onto the toolbar OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer); axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly); }