private void pageLayoutNavigationBtn_Click(object sender, EventArgs e) //布局地图导航条:Click { CommonLib.MapMouseFlag = 1; SimpleButton button = sender as SimpleButton; ICommand command = null; switch (button.Name) { case "fullExtentPageLayout": command = new ControlsPageZoomWholePageCommand(); break; //全屏 case "zoomInPageLayout": command = new ControlsPageZoomInTool(); break; //放大 case "zoomOutPageLayout": command = new ControlsPageZoomOutTool(); break; //缩小 case "panPageLayout": command = new ControlsPagePanTool(); break; //平移 case "preViewPageLayout": command = new ControlsPageZoomPageToLastExtentBackCommand(); break; //上一视图 case "nextViewPageLayout": command = new ControlsPageZoomPageToLastExtentForwardCommand(); break; //下一视图 } if (command != null) { command.OnCreate(axPageLayoutControl.Object); if (command is ITool tool) { axPageLayoutControl.CurrentTool = tool; } else { command.OnClick(); } } }
private void pageLayoutNavigationBtn_Click(object sender, EventArgs e) //布局地图导航条:Click { CurrentTool = ((SimpleButton)sender).Text.GetEnum <EPageTools>(); ICommand command = null; switch (CurrentTool) { case EPageTools.FullExtent: command = new ControlsPageZoomWholePageCommand(); break; case EPageTools.ZoomIn: command = new ControlsPageZoomInTool(); break; case EPageTools.ZoomOut: command = new ControlsPageZoomOutTool(); break; case EPageTools.Pan: command = new ControlsPagePanTool(); break; case EPageTools.PreView: command = new ControlsPageZoomPageToLastExtentBackCommand(); break; case EPageTools.NextView: command = new ControlsPageZoomPageToLastExtentForwardCommand(); break; } if (command != null) { command.OnCreate(PageLayoutControl.Object); if (command is ITool tool) { PageLayoutControl.CurrentTool = tool; } else { command.OnClick(); } } }
/// <summary> /// 根据<see cref="EPageTools"/>枚举创建ArcGIS的命令 /// </summary> /// <param name="eTool"></param> /// <returns></returns> public static ICommand CreateCommand(EPageTools eTool) { ICommand command = null; switch (eTool) { case EPageTools.FullExtent: command = new ControlsPageZoomWholePageCommand(); break; case EPageTools.ZoomIn: command = new ControlsPageZoomInTool(); break; case EPageTools.ZoomOut: command = new ControlsPageZoomOutTool(); break; case EPageTools.Pan: command = new ControlsPagePanTool(); break; case EPageTools.PreView: command = new ControlsPageZoomPageToLastExtentBackCommand(); break; case EPageTools.NextView: command = new ControlsPageZoomPageToLastExtentForwardCommand(); break; } return(command); }