MapX 控件在C# 中的应用
2024-07-21 02:17:32
供稿:网友
/* * 在这段代码中,我们应用mapx控件结合老美地图做了最基本的 * 地图浏览功能:放大、缩小、拖动、全图、测量距离、测量面积。 * * 杨雨田 [email protected] */ using system; using system.drawing; using system.collections; using system.componentmodel; using system.windows.forms; using system.data; namespace wa { public class frmmain : system.windows.forms.form { private axmapxlib.axmap mapmain; private double mapzoom; private double centerx; private double centery; private system.windows.forms.statusbar sbmain; private system.windows.forms.mainmenu mainmenu; private system.windows.forms.menuitem mimap; private system.windows.forms.menuitem mimaptoolzoomin; private system.windows.forms.menuitem mimaptoolzoomout; private system.windows.forms.menuitem mimaptoolpan; private system.windows.forms.menuitem mimaptoolrestore; private system.windows.forms.menuitem mimaptooldistance; private system.windows.forms.menuitem mimaptoolarea; private system.windows.forms.menuitem mimaptool; private system.componentmodel.container components = null; public frmmain() { initializecomponent(); } protected override void dispose( bool disposing ) { //略 } #region windows 窗体设计器生成的代码 private void initializecomponent() { //略 } #endregion [stathread] static void main() { application.run(new form1()); } private void mapmain_polytoolused(object sender, axmapxlib.cmapxevents_polytoolusedevent e) { if(e.toolnum == 99)//测量距离 { mapxlib.points pts = (mapxlib.points)e.points; mapxlib.point pt1,pt2; double d=0.0; //计算顺序两个点距离,累计得到总距离 for(int i=1;i