public MainGIS() { InitializeComponent(); //设置图层控件的同步控件 //this.axTOCControl1.SetBuddyControl(this.axMapControl1.Object); //初始化公共变量 _mapControl = axMapControl1.Object as IMapControlDefault; _pageLayoutControl = axPageLayoutControl1.Object as IPageLayoutControlDefault; _tocControl = axTOCControl1.Object as ITOCControlDefault; _DataSet = new DataSet(); //初始化主框架 _App = new MyPluginEngine.Application(); _App.StatusBar = this.uiStatusBar; _App.MapControl = _mapControl; _App.PageLayoutControl = _pageLayoutControl; _App.TOCControl = _tocControl; _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); //在同步时同时设置好与TOCControl和ToolBarControl的buddy m_controlsSynchronizer.AddFrameWorkControl(axTOCControl1.Object); m_controlsSynchronizer.AddFrameWorkControl(axToolbarControl1.Object); m_controlsSynchronizer.BindControls(true); this._App.MainCtrlsSynchronizer = m_controlsSynchronizer; //TOCControl的esriTOOControlItemMap被右键点击后弹出的快捷菜单 _mapMenu = new ToolbarMenuClass(); //通过自己的 MapMent进行添加功能,这里只有两个功能 _mapMenu.AddItem(new MapMenu(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _mapMenu.AddItem(new MapMenu(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); //使用 uid //IUID uid = new UIDClass(); //uid.Value = "esriControlCommands.ControlsMapFullExtentCommand"; //_mapMenu.AddItem(uid, -1, -1, true, esriCommandStyles.esriCommandStyleIconAndText); _mapMenu.AddItem(new ControlsMapFindCommand(), -1, 2, true, esriCommandStyles.esriCommandStyleIconAndText); //使用 progid string progid = "esriControlCommands.ControlsMapViewMenu"; _mapMenu.AddItem(progid, -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText); //使用内置 Command _mapMenu.AddItem(new ControlsAddDataCommand(), -1, 2, true, esriCommandStyles.esriCommandStyleIconAndText); _mapMenu.SetHook(this._mapControl); //2015/7/17 //TOCControl的esriTOOControlItemLayer被右键点击后弹出的快捷菜单 _layerMenu = new ToolbarMenuClass(); // 分别为缩放至图层、删除图层、打开属性表 符号选择器 //符号选择器 LayerMenu layerMenuSymbol = new LayerMenu(this._mapControl); layerMenuSymbol.SymbolChanged += new LayerMenu.SymbolChangedHandler(layerMenuSymbol_SymbolChanged); //layerMenuSymbol.SymbolChanged += new SymbolChangedHandler(layerMenuSymbol_SymbolChanged); _layerMenu.AddItem(layerMenuSymbol, 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _layerMenu.AddItem(new LayerMenu(this._mapControl), 2, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _layerMenu.AddItem(new LayerMenu(this._mapControl), 3, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _layerMenu.AddItem(new LayerMenu(this._mapControl), 4, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _layerMenu.SetHook(this._mapControl); }
public MainGIS() { InitializeComponent(); //设置图层控件的同步控件 this.axTOCControl1.SetBuddyControl(this.axMapControl1.Object); //初始化公共变量 _mapControl = axMapControl1.Object as IMapControlDefault; _pageLayoutControl = axPageLayoutControl1.Object as IPageLayoutControlDefault; _tocControl = axTOCControl1.Object as ITOCControlDefault; _DataSet = new DataSet(); //初始化主框架 _App = new MyPluginEngine.Application(); _App.StatusBar = this.uiStatusBar; _App.MapControl = _mapControl; _App.PageLayoutControl = _pageLayoutControl; _App.TOCControl = _tocControl; _App.MainPlatfrom = this; _App.Caption = this.Text; _App.Visible = this.Visible; _App.CurrentTool = null; _App.MainDataSet = _DataSet; //让MapControl和PageLatoutControl保存同步 axTOCControl1.SetBuddyControl(_mapControl); m_controlsSynchronizer = new ControlsSynchronizer(_mapControl, _pageLayoutControl); //在同步是同时设置好与TOCControl和ToolBarControl的buddy m_controlsSynchronizer.AddFrameWorkControl(axTOCControl1.Object); m_controlsSynchronizer.AddFrameWorkControl(axToolbarControl1.Object); m_controlsSynchronizer.BindControls(true); //TOCControl的esriTOOControlItemMap被右键点击后弹出的快捷菜单 _mapMenu = new ToolbarMenuClass(); //通过自己的 MapMent进行添加功能,这里只有两个功能 _mapMenu.AddItem(new MapMenu(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _mapMenu.AddItem(new MapMenu(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly); //使用 uid //IUID uid = new UIDClass(); //uid.Value = "esriControlCommands.ControlsMapFullExtent"; //_mapMenu.AddItem(uid, -1, -1, true, esriCommandStyles.esriCommandStyleIconAndText); _mapMenu.AddItem(new ControlsMapFindCommand(), -1, 2, true, esriCommandStyles.esriCommandStyleIconAndText); //使用 progid string progid = "esriControlCommands.ControlsMapViewMenu"; _mapMenu.AddItem(progid, -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText); //使用内置 Command _mapMenu.AddItem(new ControlsAddDataCommand(), -1 , 2, true, esriCommandStyles.esriCommandStyleIconAndText); _mapMenu.SetHook(this._mapControl); //2015/7/17 //TOCControl的esriTOOControlItemLayer被右键点击后弹出的快捷菜单 _layerMenu = new ToolbarMenuClass(); // 分别为缩放至图层、删除图层、打开属性表 + _layerMenu.AddItem(new LayerMenu(this._mapControl), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _layerMenu.AddItem(new LayerMenu(this._mapControl), 2, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _layerMenu.AddItem(new LayerMenu(this._mapControl), 3, 0, false, esriCommandStyles.esriCommandStyleTextOnly); _layerMenu.SetHook(this._mapControl); }