答案:MapObjects2.2 在C#中的应用(基本地图功能)
关键字:MapObjects 2.2 C#
仅仅实现了地图的放大、缩小、漫游、全图、距离、面积等功能。
/*
* 杨雨田 blue_bat@126.com
* 2004年7月27日
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Artemis.IVS.Test
{
/// <summary>
/// 处理实例
/// </summary>
public class FrmMain : System.Windows.Forms.Form
{
private AxMapObjects2.AxMap mapMain;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem miZoomIn;
private System.Windows.Forms.MenuItem miZoomOut;
private System.Windows.Forms.MenuItem miPan;
private System.Windows.Forms.MenuItem miFullView;
private int CurOperate = 0;
private System.Windows.Forms.MenuItem miSelectByPoint;
private System.Windows.Forms.MenuItem miDistance;
private System.Windows.Forms.MenuItem miArea;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public FrmMain()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FrmMain));
this.mapMain = new AxMapObjects2.AxMap();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.miZoomIn = new System.Windows.Forms.MenuItem();
this.miZoomOut = new System.Windows.Forms.MenuItem();
this.miPan = new System.Windows.Forms.MenuItem();
this.miFullView = new System.Windows.Forms.MenuItem();
this.miSelectByPoint = new System.Windows.Forms.MenuItem();
this.miDistance = new System.Windows.Forms.MenuItem();
this.miArea = new System.Windows.Forms.MenuItem();
((System.ComponentModel.ISupportInitialize)(this.mapMain)).BeginInit();
this.SuspendLayout();
//
// mapMain
//
this.mapMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.mapMain.Location = new System.Drawing.Point(0, 0);
this.mapMain.Name = "mapMain";
this.mapMain.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("mapMain.OcxState")));
this.mapMain.Size = new System.Drawing.Size(592, 401);
this.mapMain.TabIndex = 0;
this.mapMain.MouseDownEvent += new AxMapObjects2._DMapEvents_MouseDownEventHandler(this.mapMain_MouseDownEvent);
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.miZoomIn,
this.miZoomOut,
this.miPan,
this.miFullView,
this.miSelectByPoint,
this.miDistance,
this.miArea});
//
// miZoomIn
//
this.miZoomIn.Index = 0;
this.miZoomIn.Text = "放大";
this.miZoomIn.Click += new System.EventHandler(this.miZoomIn_Click);
//
// miZoomOut
//
this.miZoomOut.Index = 1;
this.miZoomOut.Text = "缩小";
this.miZoomOut.Click += new System.EventHandler(this.miZoomOut_Click);
//
// miPan
//
this.miPan.Index = 2;
this.miPan.Text = "漫游";
this.miPan.Click += new System.EventHandler(this.miPan_Click);
//
// miFullView
//
this.miFullView.Index = 3;
this.miFullView.Text = "全图";
this.miFullView.Click += new System.EventHandler(this.miFullView_Click);
//
// miSelectByPoint
//
this.miSelectByPoint.Index = 4;
this.miSelectByPoint.Text = "点选";
this.miSelectByPoint.Click += new System.EventHandler(this.miSelectByPoint_Click);
//
// miDistance
//
this.miDistance.Index = 5;
this.miDistance.Text = "距离";
this.miDistance.Click += new System.EventHandler(this.miDistance_Click);
//
// miArea
//
this.miArea.Index = 6;
this.miArea.Text = "面积";
this.miArea.Click += new System.EventHandler(this.miArea_Click);
//
// FrmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(592, 401);
this.Controls.Add(this.mapMain);
this.Menu = this.mainMenu1;
this.Name = "FrmMain";
this.Text = "Artemis.IVS.Test";
this.Load += new System.EventHandler(this.FrmMain_Load);
((System.ComponentModel.ISupportInitialize)(this.mapMain)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
上一个:把RichTextBox中的文本保存到Sql Server中(C#)
下一个:C# 把指定控件显示在最上面