MapX 控件在C# 中的应用

80酷酷网    80kuku.com

  控件/* * 在这段代码中,我们应用MapX控件结合老美地图做了最基本的 * 地图浏览功能:放大、缩小、拖动、全图、测量距离、测量面积。 * * 杨雨田 YangYutianHotmail.Com */ 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

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: