//private Dictionary<string, NBGIS.PluginEngine.IDockableWindowDef> m_DockableWindowCol = null; public MainGIS() { InitializeComponent(); //为TOC设置伙伴控件,与MapControl关联 this.axTOCControl.SetBuddyControl(this.axMapControl.Object); //从控件中得到相应接口的对象 m_MapControl = axMapControl.Object as ESRI.ArcGIS.Controls.IMapControlDefault; m_PageLayoutControl = axPageLayoutControl.Object as ESRI.ArcGIS.Controls.IPageLayoutControlDefault; m_TOCControl = axTOCControl.Object as ESRI.ArcGIS.Controls.ITOCControlDefault; //初始化数据集对象 m_DataSet = new DataSet(); //初始化主框架对象 m_Application = new NBGIS.PluginEngine.Application(); m_Application.StatusBar = this.StatusBar; m_Application.MapControl = m_MapControl; m_Application.PageLayoutControl = m_PageLayoutControl; m_Application.MainPlatform = this; m_Application.Caption = this.Text; m_Application.Visible = this.Visible; m_Application.CurrentTool = null; m_Application.MainDataSet = this.m_DataSet; m_Application.Map = m_MapControl.Map; //让MapControl与PageLayoutControl保持同步 m_ControlsSynchronizer = new ControlsSynchronizer(m_MapControl, m_PageLayoutControl); m_ControlsSynchronizer.BindControls(true); m_ControlsSynchronizer.AddFrameworkControl(axTOCControl.Object); }
public MainGIS() { InitializeComponent(); //设置图层控件的同步控件 axTOCControl.SetBuddyControl(axMapControl); //初始化公共变量 _mapControl = axMapControl.Object as IMapControlDefault; _pageLayoutControl = axPageLayoutControl.Object as IPageLayoutControlDefault; _tocControl = axTOCControl.Object as ITOCControlDefault; _DataSet = new DataSet(); //初始化主框架 _App = new NBGIS.PluginEngine.Application(); _App.StatusBar = this.uiStatusBar; _App.MapControl = _mapControl; _App.PageLayoutControl = _pageLayoutControl; _App.MainPlatfrom = this; _App.Caption = this.Text; _App.Visible = this.Visible; _App.CurrentTool = null; _App.MainDataSet = _DataSet; //让MapControl和PageLatoutControl保存同步 m_controlsSynchronizer = new ControlsSynchronizer(_mapControl, _pageLayoutControl); m_controlsSynchronizer.BindControls(true); m_controlsSynchronizer.AddFrameWorkControl(axTOCControl.Object); //TOCControl的esriTOOControlItemMap被右键点击后弹出的快捷菜单 _mapMenu = new ToolbarMenuClass(); _mapMenu.AddItem(new MapMenu(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _mapMenu.AddItem(new MapMenu(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); _mapMenu.SetHook(this._mapControl); }