Arcgis Engine - 脱离ToolBarControl控件的命令和工具

  可以手动实现脱离ToolBarControl控件的命令和工具

 1 //打开文件.

 2         private void file_tsmItem_Click(object sender, EventArgs e) {

 3             ESRI.ArcGIS.SystemUI.ICommand mxd = new ESRI.ArcGIS.Controls.ControlsOpenDocCommandClass();

 4             mxd.OnCreate(mapCtrl_main.Object);  //传递的应该是AxMapControl.Object,而不是AxMapControl.

 5             mxd.OnClick();

 6         }

 7 

 8         //添加数据.

 9         private void addData_tsmItem_Click(object sender, EventArgs e) {

10             ESRI.ArcGIS.SystemUI.ICommand addData = new ESRI.ArcGIS.Controls.ControlsAddDataCommand();

11             addData.OnCreate(mapCtrl_main.Object);

12             addData.OnClick();

13         }

14         

15         //地图视图.

16         private void zoomIn_tsmItem_Click(object sender, EventArgs e) {

17             ESRI.ArcGIS.SystemUI.ICommand zoomIn = new ESRI.ArcGIS.Controls.ControlsMapZoomInTool();

18             zoomIn.OnCreate(mapCtrl_main.Object);

19             mapCtrl_main.CurrentTool = (ESRI.ArcGIS.SystemUI.ITool)zoomIn;

20         }

21 

22         private void zoomOut_tsmItem_Click(object sender, EventArgs e) {

23             ESRI.ArcGIS.SystemUI.ICommand zoomOut = new ESRI.ArcGIS.Controls.ControlsMapZoomOutTool();

24             zoomOut.OnCreate(mapCtrl_main.Object);

25             mapCtrl_main.CurrentTool = (ESRI.ArcGIS.SystemUI.ITool)zoomOut;

26         }

 

  

 

你可能感兴趣的:(ArcGis Engine)