欢迎来到天天文库
浏览记录
ID:3913634
大小:388.25 KB
页数:10页
时间:2017-11-25
《arcgis.engine.demo.mapviewer》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、ArcGISEngineDemo:MapViewer载入Engine控件1、新建Engine项目:MapViewer;2、在Toolbox中添加如下控件:AxLicenseControl、AxMapControl、AxPageLayoutControl、AxTOCControl、AxToolbarControl;3、添加GIS参考:ESRI.ArcGIS.ADF、ESRI.ArcGIS.Carto、ESRI.ArcGIS.Display、ESRI.ArcGIS.Geometry、ESRI.ArcGIS.Output、ESRI.ArcGIS.System和ESRI.ArcGIS.System
2、UI;将Engine控件放置到应用程序容器中4、重命名Form1,更名为MapViewer;5、以Design模式打开MapViewer窗体,双击Toolbox中的Menus&Toolbars栏目下的MenuStrip控件;6、双击LicenseControl,并添加MapControl、PageLayoutControl、TOCControl和ToolbarControl;7、调整MapViewer窗体大小,如下图所示:双击MapViewer窗体,导入GIS参考:ImportsESRI.ArcGIS.CartoImportsESRI.ArcGIS.ControlsImportsESRI.
3、ArcGIS.DisplayImportsESRI.ArcGIS.GeometryImportsESRI.ArcGIS.SystemUIImportsESRI.ArcGIS.esriSystem初始化LicenseControl控件8、右击LicenseControl,选择ActiveX-Properties,打开LicenseControl属性页;9、选择产品许可级别,此处选择ArcGISEngine;载入地图到PageLayoutControl和MapControl控件中10、选择Form_Load事件,输入以下代码:PrivateSubMapViewer_Load(ByValsend
4、erAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load'Loadapre-authoredmapdocumentintothePageLayoutControlusingrealativepaths.DimsFileNameAsString="D:arcgisArcTutorArcReaderandPublisherGulfofSt.Lawrence.mxd"IfAxPageLayoutControl1.CheckMxFile(sFileName)ThenAxPageLayoutControl1.LoadMxFil
5、e(sFileName)EndIfEndSub11、以Design模式显示MapViewer窗体,从属性窗口中选择axPageLayoutControl1控件,显示PageLayoutControlevents,双击OnPageLayoutReplacedevent,在代码窗口中添加一个eventhandler:PrivateSubAxPageLayoutControl1_OnPageLayoutReplaced(ByValsenderAsSystem.Object,ByValeAsESRI.ArcGIS.Controls.IPageLayoutControlEvents_OnPageLa
6、youtReplacedEvent)HandlesAxPageLayoutControl1.OnPageLayoutReplaced'Loadthesamepre-authoredmapdocumentintotheMapControl.AxMapControl1.LoadMxFile(AxPageLayoutControl1.DocumentFilename)'SettheextentoftheMapControltothefullextentofthedata.AxMapControl1.Extent=AxMapControl1.FullExtentEndSub设置TOCControl
7、和ToolbarControl控件的buddycontrols属性12、在Form_Loadevent中,输入以下代码:PrivateSubMapViewer_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.Load'Setbuddycontrols.AxTOCControl1.SetBuddyControl(AxPageLay
此文档下载收益归作者所有
点击更多查看相关文章~~