欢迎光临
我们一直在努力

c#中调用mapx5.0(一)-.NET教程,C#语言

建站超值云服务器,限时71元/月

这是 我在.net环境中调用mapx5.0控件 的一次test,前几次网上没有发现这方面的文章,所以自己

把几个代码拿出 来:这里有些代码是自动生成的,但只要把几篇文章的代码直接拷贝到工程里 就

能直接运行的。

using system.drawing;

using system.collections;

using system.componentmodel;

using system.windows.forms;

using system.data;

using system.io;

namespace gistestbymyself

{

/// <summary>

/// form1 的摘要说明。

/// </summary>

public class frmmain : system.windows.forms.form

{

#region 私有变量的声明

private axmapxlib.axmap axmap1;

private axmapxlib.axmap axmap2;

private double zoom;

private double centerx;

private double centery;

#endregion

#region windows 窗体上拖入窗体的控件

/// <summary>

///

/// 窗体信息。

/// </summary>

private system.windows.forms.toolbar toolbar2;

private system.windows.forms.toolbarbutton tbfangda;

private system.windows.forms.toolbarbutton tbbianxiao;

private system.windows.forms.toolbarbutton tbmanyou;

private system.windows.forms.toolbarbutton tbbiaozhu;

private system.windows.forms.toolbarbutton tbjuli;

private system.windows.forms.toolbarbutton tbshuaxin;

private system.windows.forms.toolbarbutton tbxiangxi;

private system.windows.forms.toolbarbutton tbzuiduan;

private system.windows.forms.toolbarbutton tbmianji;

private system.windows.forms.label label1;

private system.windows.forms.toolbarbutton tbxuanze;

private system.windows.forms.mainmenu mainmenu1;

private system.windows.forms.menuitem menuitem1;

private system.windows.forms.menuitem menuitem2;

private system.windows.forms.menuitem menuitem3;

private system.windows.forms.menuitem mutuceng;

private system.windows.forms.contextmenu comu;

private system.windows.forms.menuitem menuitem4;

private system.windows.forms.menuitem menuitem5;

private system.windows.forms.menuitem menuitem6;

private system.windows.forms.menuitem menuitem7;

private system.windows.forms.contextmenu comu1;

private system.windows.forms.menuitem menuitem8;

private system.windows.forms.menuitem menuitem9;

private system.windows.forms.toolbarbutton tbtianjiafuhao;

private system.windows.forms.menuitem menuitem10;

private system.windows.forms.menuitem menuitem11;

private system.windows.forms.menuitem menuitem12;

private system.windows.forms.menuitem menuitem13;

private system.windows.forms.menuitem menuitem14;

private system.windows.forms.menuitem menuitem15;

private system.windows.forms.menuitem menuitem16;

private system.windows.forms.menuitem menuitem17;

private system.windows.forms.menuitem menuitem18;

private system.windows.forms.menuitem menuitem19;

private system.windows.forms.menuitem menuitem20;

private system.windows.forms.menuitem menuitem21;

private system.windows.forms.menuitem menuitem22;

private system.windows.forms.menuitem menuitem23;

private system.windows.forms.menuitem menuitem24;

private system.windows.forms.menuitem menuitem25;

private system.windows.forms.menuitem menuitem26;

private system.windows.forms.splitter splitter1;

private system.windows.forms.menuitem menuitem27;

private system.windows.forms.toolbar toolbar1;

private system.windows.forms.toolbarbutton tbadddian;

private system.windows.forms.toolbarbutton tbaddxian;

private system.windows.forms.toolbarbutton tbaddquxian;

private system.windows.forms.toolbarbutton tbaddqumian;

private system.windows.forms.toolbarbutton tbshezhi;

private system.windows.forms.toolbarbutton tbline;

private system.windows.forms.menuitem menuitem28;

private system.windows.forms.menuitem menuitem29;

private system.windows.forms.menuitem menuitem30;

private system.windows.forms.menuitem menuitem31;

private system.windows.forms.menuitem menuitem32;

private system.windows.forms.menuitem menuitem33;

private system.windows.forms.menuitem menuitem34;

private system.windows.forms.menuitem menuitem35;

/// <summary>

/// 必需的设计器变量。

/// </summary>

private system.componentmodel.container components = null;

#endregion

#region frmmain类的初始化和form_load时发生时的动作

public frmmain()

{

//

// windows 窗体设计器支持所必需的

//

initializecomponent();

//

// todo: 在 initializecomponent 调用后添加任何构造函数代码

//

this.zoom=axmap1.zoom; //取得初始化时的地图比例

this.centerx=axmap1.centerx;

this.centery=axmap1.centery; //取得初始化时的地图坐标,供刷新时使用

axmap1.createcustomtool(10,mapxlib.tooltypeconstants.mitooltypepoly,mapxlib.cursorconstants.microsscursor,null,null,false);

//创建距离工具

axmap1.createcustomtool(11,mapxlib.tooltypeconstants.mitooltypepolygon,mapxlib.cursorconstants.microsscursor,null,null,false);

//创建面积工具

}

//*********************************

private void form1_load(object sender, system.eventargs e)

{

axmap1.geoset=@"d:\….\china.gst";

axmap2.geoset= directory.getcurrentdirectory()+ @"\….\*.gst";

axmap1.titletext="中国";

axmap2.titletext="***";

}

#endregion

//*****************************

#region windows 窗体设计器生成的代码

/// <summary>

/// 设计器支持所需的方法 – 不要使用代码编辑器修改

/// 此方法的内容。

/// </summary>

/// <summary>

/// 清理所有正在使用的资源。

/// </summary>

protected override void dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.dispose();

}

}

base.dispose( disposing );

}

private void initializecomponent()

{

system.resources.resourcemanager resources = new system.resources.resourcemanager(typeof(frmmain));

this.axmap1 = new axmapxlib.axmap();

this.axmap2 = new axmapxlib.axmap();

this.toolbar2 = new system.windows.forms.toolbar();

this.tbxuanze = new system.windows.forms.toolbarbutton();

this.tbfangda = new system.windows.forms.toolbarbutton();

this.tbbianxiao = new system.windows.forms.toolbarbutton();

this.tbmanyou = new system.windows.forms.toolbarbutton();

this.tbbiaozhu = new system.windows.forms.toolbarbutton();

this.tbtianjiafuhao = new system.windows.forms.toolbarbutton();

this.tbjuli = new system.windows.forms.toolbarbutton();

this.tbmianji = new system.windows.forms.toolbarbutton();

this.tbshuaxin = new system.windows.forms.toolbarbutton();

this.tbxiangxi = new system.windows.forms.toolbarbutton();

this.tbzuiduan = new system.windows.forms.toolbarbutton();

this.label1 = new system.windows.forms.label();

this.mainmenu1 = new system.windows.forms.mainmenu();

this.menuitem1 = new system.windows.forms.menuitem();

this.menuitem20 = new system.windows.forms.menuitem();

this.menuitem21 = new system.windows.forms.menuitem();

this.menuitem22 = new system.windows.forms.menuitem();

this.menuitem23 = new system.windows.forms.menuitem();

this.menuitem24 = new system.windows.forms.menuitem();

this.menuitem25 = new system.windows.forms.menuitem();

this.menuitem26 = new system.windows.forms.menuitem();

this.menuitem2 = new system.windows.forms.menuitem();

this.menuitem3 = new system.windows.forms.menuitem();

this.menuitem29 = new system.windows.forms.menuitem();

this.menuitem28 = new system.windows.forms.menuitem();

this.menuitem27 = new system.windows.forms.menuitem();

this.menuitem15 = new system.windows.forms.menuitem();

this.menuitem32 = new system.windows.forms.menuitem();

this.menuitem31 = new system.windows.forms.menuitem();

this.mutuceng = new system.windows.forms.menuitem();

this.menuitem30 = new system.windows.forms.menuitem();

this.menuitem16 = new system.windows.forms.menuitem();

this.menuitem10 = new system.windows.forms.menuitem();

this.menuitem11 = new system.windows.forms.menuitem();

this.menuitem12 = new system.windows.forms.menuitem();

this.menuitem13 = new system.windows.forms.menuitem();

this.menuitem14 = new system.windows.forms.menuitem();

this.menuitem17 = new system.windows.forms.menuitem();

this.menuitem18 = new system.windows.forms.menuitem();

this.menuitem19 = new system.windows.forms.menuitem();

this.comu = new system.windows.forms.contextmenu();

this.menuitem4 = new system.windows.forms.menuitem();

this.menuitem5 = new system.windows.forms.menuitem();

this.menuitem6 = new system.windows.forms.menuitem();

this.menuitem7 = new system.windows.forms.menuitem();

this.comu1 = new system.windows.forms.contextmenu();

this.menuitem8 = new system.windows.forms.menuitem();

this.menuitem9 = new system.windows.forms.menuitem();

this.splitter1 = new system.windows.forms.splitter();

this.toolbar1 = new system.windows.forms.toolbar();

this.tbadddian = new system.windows.forms.toolbarbutton();

this.tbaddxian = new system.windows.forms.toolbarbutton();

this.tbaddquxian = new system.windows.forms.toolbarbutton();

this.tbaddqumian = new system.windows.forms.toolbarbutton();

this.tbline = new system.windows.forms.toolbarbutton();

this.tbshezhi = new system.windows.forms.toolbarbutton();

this.menuitem33 = new system.windows.forms.menuitem();

this.menuitem34 = new system.windows.forms.menuitem();

this.menuitem35 = new system.windows.forms.menuitem();

((system.componentmodel.isupportinitialize)(this.axmap1)).begininit();

((system.componentmodel.isupportinitialize)(this.axmap2)).begininit();

this.suspendlayout();

//

// axmap1

//

this.axmap1.anchor = ((system.windows.forms.anchorstyles)((((system.windows.forms.anchorstyles.top | system.windows.forms.anchorstyles.bottom)

| system.windows.forms.anchorstyles.left)

| system.windows.forms.anchorstyles.right)));

this.axmap1.enabled = true;

this.axmap1.location = new system.drawing.point(8, 120);

this.axmap1.name = "axmap1";

this.axmap1.ocxstate = ((system.windows.forms.axhost.state)(resources.getobject("axmap1.ocxstate")));

this.axmap1.size = new system.drawing.size(424, 339);

this.axmap1.tabindex = 0;

this.axmap1.polytoolused += new axmapxlib.cmapxevents_polytoolusedeventhandler(this.mapmain_polytoolused);

this.axmap1.mouseupevent += new axmapxlib.cmapxevents_mouseupeventhandler(this.axmap1_mouseupevent);

this.axmap1.thememodifyrequested += new axmapxlib.cmapxevents_thememodifyrequestedeventhandler(this.axmap1_thememodifyrequested);

this.axmap1.mousedownevent += new axmapxlib.cmapxevents_mousedowneventhandler(this.axmap1_mousedownevent);

this.axmap1.mapviewchanged += new system.eventhandler(this.axmap1_mapviewchanged);

//

// axmap2

//

this.axmap2.anchor = ((system.windows.forms.anchorstyles)((((system.windows.forms.anchorstyles.top | system.windows.forms.anchorstyles.bottom)

| system.windows.forms.anchorstyles.left)

| system.windows.forms.anchorstyles.right)));

this.axmap2.enabled = true;

this.axmap2.location = new system.drawing.point(472, 136);

this.axmap2.name = "axmap2";

this.axmap2.ocxstate = ((system.windows.forms.axhost.state)(resources.getobject("axmap2.ocxstate")));

this.axmap2.size = new system.drawing.size(240, 203);

this.axmap2.tabindex = 1;

//

// toolbar2

//

this.toolbar2.buttons.addrange(new system.windows.forms.toolbarbutton[] {

this.tbxuanze,

this.tbfangda,

this.tbbianxiao,

this.tbmanyou,

this.tbbiaozhu,

this.tbtianjiafuhao,

this.tbjuli,

this.tbmianji,

this.tbshuaxin,

this.tbxiangxi,

this.tbzuiduan});

this.toolbar2.buttonsize = new system.drawing.size(55, 35);

this.toolbar2.dropdownarrows = true;

this.toolbar2.location = new system.drawing.point(0, 0);

this.toolbar2.name = "toolbar2";

this.toolbar2.showtooltips = true;

this.toolbar2.size = new system.drawing.size(776, 41);

this.toolbar2.tabindex = 3;

this.toolbar2.buttonclick += new system.windows.forms.toolbarbuttonclickeventhandler(this.toolbar2_buttonclick);

//

// tbxuanze

//

this.tbxuanze.text = "选择";

//

// tbfangda

//

this.tbfangda.text = "放大";

this.tbfangda.tooltiptext = "放大";

//

// tbbianxiao

//

this.tbbianxiao.text = "缩小";

//

// tbmanyou

//

this.tbmanyou.text = "漫游";

//

// tbbiaozhu

//

this.tbbiaozhu.text = "标注";

//

// tbtianjiafuhao

//

this.tbtianjiafuhao.text = "添加符号";

//

// tbjuli

//

this.tbjuli.text = "测距";

//

// tbmianji

//

this.tbmianji.text = "面积";

//

// tbshuaxin

//

this.tbshuaxin.text = "刷新";

//

// tbxiangxi

//

this.tbxiangxi.text = "详细";

//

// tbzuiduan

//

this.tbzuiduan.text = "最短实体";

//

// label1

//

this.label1.location = new system.drawing.point(48, 104);

this.label1.name = "label1";

this.label1.size = new system.drawing.size(208, 16);

this.label1.tabindex = 4;

this.label1.text = "label1";

//

// mainmenu1

//

this.mainmenu1.menuitems.addrange(new system.windows.forms.menuitem[] {

this.menuitem1,

this.menuitem3,

this.menuitem10,

this.menuitem17,

this.menuitem18});

//

// menuitem1

//

this.menuitem1.index = 0;

this.menuitem1.menuitems.addrange(new system.windows.forms.menuitem[] {

this.menuitem20,

this.menuitem21,

this.menuitem22,

this.menuitem23,

this.menuitem24,

this.menuitem25,

this.menuitem26,

this.menuitem33,

this.menuitem35,

this.menuitem34,

this.menuitem2});

this.menuitem1.text = "文件";

//

// menuitem20

//

this.menuitem20.index = 0;

this.menuitem20.text = "打开地图…";

this.menuitem20.click += new system.eventhandler(this.menuitem20_click);

//

// menuitem21

//

this.menuitem21.index = 1;

this.menuitem21.text = "添加图层…";

this.menuitem21.click += new system.eventhandler(this.menuitem21_click);

//

// menuitem22

//

this.menuitem22.index = 2;

this.menuitem22.text = "-";

//

// menuitem23

//

this.menuitem23.index = 3;

this.menuitem23.text = "保存";

this.menuitem23.click += new system.eventhandler(this.menuitem23_click);

//

// menuitem24

//

this.menuitem24.index = 4;

this.menuitem24.text = "另存为…";

this.menuitem24.click += new system.eventhandler(this.menuitem24_click);

//

// menuitem25

//

this.menuitem25.index = 5;

this.menuitem25.text = "导出..";

this.menuitem25.click += new system.eventhandler(this.menuitem25_click);

//

// menuitem26

//

this.menuitem26.index = 6;

this.menuitem26.text = "-";

//

// menuitem2

//

this.menuitem2.index = 10;

this.menuitem2.text = "退出";

//

// menuitem3

//

this.menuitem3.index = 1;

this.menuitem3.menuitems.addrange(new system.windows.forms.menuitem[] {

this.menuitem29,

this.menuitem28,

this.menuitem27,

this.menuitem15,

this.menuitem32,

this.menuitem31,

this.mutuceng,

this.menuitem30,

this.menuitem16});

this.menuitem3.text = "地图";

//

// menuitem29

//

this.menuitem29.index = 0;

this.menuitem29.text = "坐标变换(投影)";

this.menuitem29.click += new system.eventhandler(this.menuitem29_click);

//

// menuitem28

//

this.menuitem28.index = 1;

this.menuitem28.text = "-";

//

// menuitem27

//

this.menuitem27.index = 2;

this.menuitem27.text = "编辑";

this.menuitem27.click += new system.eventhandler(this.menuitem27_click);

//

// menuitem15

//

this.menuitem15.index = 3;

this.menuitem15.text = "-";

//

// menuitem32

//

this.menuitem32.index = 4;

this.menuitem32.text = "缩放图层";

this.menuitem32.click += new system.eventhandler(this.menuitem32_click);

//

// menuitem31

//

this.menuitem31.index = 5;

this.menuitem31.text = "选择图层";

this.menuitem31.click += new system.eventhandler(this.menuitem31_click);

//

// mutuceng

//

this.mutuceng.index = 6;

this.mutuceng.text = "图层控制";

this.mutuceng.click += new system.eventhandler(this.mutuceng_click);

//

// menuitem30

//

this.menuitem30.index = 7;

this.menuitem30.text = "-";

//

// menuitem16

//

this.menuitem16.index = 8;

this.menuitem16.text = "属性";

this.menuitem16.click += new system.eventhandler(this.menuitem16_click);

//

// menuitem10

//

this.menuitem10.index = 2;

this.menuitem10.menuitems.addrange(new system.windows.forms.menuitem[] {

this.menuitem11,

this.menuitem12,

this.menuitem13,

this.menuitem14});

this.menuitem10.text = "注释";

//

// menuitem11

//

this.menuitem11.index = 0;

this.menuitem11.text = "添加符号";

this.menuitem11.click += new system.eventhandler(this.menuitem11_click);

//

// menuitem12

//

this.menuitem12.index = 1;

this.menuitem12.text = "添加文本";

this.menuitem12.click += new system.eventhandler(this.menuitem12_click);

//

// menuitem13

//

this.menuitem13.index = 2;

this.menuitem13.text = "移除";

this.menuitem13.click += new system.eventhandler(this.menuitem13_click);

//

// menuitem14

//

this.menuitem14.index = 3;

this.menuitem14.text = "设置";

this.menuitem14.click += new system.eventhandler(this.menuitem14_click);

//

// menuitem17

//

this.menuitem17.index = 3;

this.menuitem17.text = "窗口";

//

// menuitem18

//

this.menuitem18.index = 4;

this.menuitem18.menuitems.addrange(new system.windows.forms.menuitem[] {

this.menuitem19});

this.menuitem18.text = "帮助";

//

// menuitem19

//

this.menuitem19.index = 0;

this.menuitem19.text = "关于mapx";

this.menuitem19.click += new system.eventhandler(this.menuitem19_click);

//

// comu

//

this.comu.menuitems.addrange(new system.windows.forms.menuitem[] {

this.menuitem4,

this.menuitem5,

this.menuitem6,

this.menuitem7});

//

// menuitem4

//

this.menuitem4.index = 0;

this.menuitem4.text = "普通";

this.menuitem4.click += new system.eventhandler(this.menuitem4_click);

//

// menuitem5

//

this.menuitem5.index = 1;

this.menuitem5.text = "矩形";

this.menuitem5.click += new system.eventhandler(this.menuitem5_click);

//

// menuitem6

//

this.menuitem6.index = 2;

this.menuitem6.text = "圆形";

this.menuitem6.click += new system.eventhandler(this.menuitem6_click);

//

// menuitem7

//

this.menuitem7.index = 3;

this.menuitem7.text = "多边形";

this.menuitem7.click += new system.eventhandler(this.menuitem7_click);

//

// comu1

//

this.comu1.menuitems.addrange(new system.windows.forms.menuitem[] {

this.menuitem8,

this.menuitem9});

//

// menuitem8

//

this.menuitem8.index = 0;

this.menuitem8.text = "添加符号";

this.menuitem8.click += new system.eventhandler(this.menuitem8_click);

//

// menuitem9

//

this.menuitem9.index = 1;

this.menuitem9.text = "添加";

this.menuitem9.click += new system.eventhandler(this.menuitem9_click);

//

// splitter1

//

this.splitter1.location = new system.drawing.point(0, 41);

this.splitter1.name = "splitter1";

this.splitter1.size = new system.drawing.size(3, 432);

this.splitter1.tabindex = 5;

this.splitter1.tabstop = false;

//

// toolbar1

//

this.toolbar1.buttons.addrange(new system.windows.forms.toolbarbutton[] {

this.tbadddian,

this.tbaddxian,

this.tbaddquxian,

this.tbaddqumian,

this.tbline,

this.tbshezhi});

this.toolbar1.dock = system.windows.forms.dockstyle.none;

this.toolbar1.dropdownarrows = true;

this.toolbar1.location = new system.drawing.point(0, 40);

this.toolbar1.name = "toolbar1";

this.toolbar1.showtooltips = true;

this.toolbar1.size = new system.drawing.size(488, 28);

this.toolbar1.tabindex = 6;

this.toolbar1.textalign = system.windows.forms.toolbartextalign.right;

this.toolbar1.visible = false;

this.toolbar1.wrappable = false;

this.toolbar1.buttonclick += new system.windows.forms.toolbarbuttonclickeventhandler(this.toolbar1_buttonclick);

//

// tbadddian

//

this.tbadddian.text = "点 ";

this.tbadddian.visible = false;

//

// tbaddxian

//

this.tbaddxian.text = "线 ";

this.tbaddxian.visible = false;

//

// tbaddquxian

//

this.tbaddquxian.text = "曲线 ";

this.tbaddquxian.visible = false;

//

// tbaddqumian

//

this.tbaddqumian.text = "面 ";

this.tbaddqumian.visible = false;

//

// tbline

//

this.tbline.style = system.windows.forms.toolbarbuttonstyle.separator;

//

// tbshezhi

//

this.tbshezhi.text = "设置 ";

this.tbshezhi.visible = false;

//

// menuitem33

//

this.menuitem33.index = 7;

this.menuitem33.text = "打印设置";

//

// menuitem34

//

this.menuitem34.index = 9;

this.menuitem34.text = "-";

//

// menuitem35

//

this.menuitem35.index = 8;

this.menuitem35.text = "打印…";

//

// frmmain

//

this.autoscalebasesize = new system.drawing.size(6, 14);

this.clientsize = new system.drawing.size(776, 473);

this.controls.add(this.toolbar1);

this.controls.add(this.splitter1);

this.controls.add(this.label1);

this.controls.add(this.toolbar2);

this.controls.add(this.axmap2);

this.controls.add(this.axmap1);

this.menu = this.mainmenu1;

this.name = "frmmain";

this.text = "frmmain";

this.load += new system.eventhandler(this.form1_load);

((system.componentmodel.isupportinitialize)(this.axmap1)).endinit();

((system.componentmodel.isupportinitialize)(this.axmap2)).endinit();

this.resumelayout(false);

}

#endregion

#region 应用程序的主入口点

/// <summary>

/// 应用程序的主入口点。

/// </summary>

[stathread]

static void main()

{

frmmain fmain;

application.run(fmain=new frmmain());

}

#endregion

//****************************************

#region axmap1对象的属性操作,一般都在其他窗口里被使用

/// <summary>

/// 在这里适用属性主要是为了axmap1这个私有的对象能在其他窗体中获得一些需要的改变

/// </summary>

///

//属性1

public mapxlib.style systyle //属性操作,设置或取得符号的样式,在 frmannotation 中使用了该属性,

{

set

{

axmap1.defaultstyle=value;

}

get

{

return axmap1.defaultstyle;

}

}

//属性2

public mapxlib.style editstyle //属性操作,设置或取得在编辑图层时,改变的点,线和曲面的样式 在frmeditable

{

set //中使用了该属性,

{

axmap1.autoredraw=true;

axmap1.layers.insertionlayer.style=value;

}

get

{

axmap1.layers.insertionlayer.overridestyle=true;

axmap1.autoredraw=false;

return axmap1.layers.insertionlayer.style;

}

}

//属性3

public mapxlib.layers layer //属性操作,通过该属性,图层选择显示窗口(frmviewlyr)可以操作axmap1的layers属性,

{ //在frmviewlyr_load 时可以得到 layers

get

{

return axmap1.layers;

}

}

//属性4

public string lyrname //属性操作,通过该属性,得到图层选择显示窗口(frmviewlyr)中coblyr.text中的值

{ //来显示那个图层将被显示

set

{

if(value=="all layers")

axmap1.ctlbounds=axmap1.layers.bounds; //注意,这里使用ctlbounds属性(mapx的属性),而不是bounds(.net本身的属性)在.net

else

axmap1.ctlbounds=axmap1.layers[value].bounds; //环境下,有点改变,

}

}

#endregion

//***********************************

#region 工具条,里面包含选择、拖动漫游、放大缩小等一些工具

private void toolbar2_buttonclick(object sender, system.windows.forms.toolbarbuttonclickeventargs e)

{

try

{

if(e.button==tbfangda)

axmap1.currenttool=mapxlib.toolconstants.mizoomintool;//1003

if(e.button==tbbianxiao)

axmap1.currenttool=mapxlib.toolconstants.mizoomouttool;//缩小地图

if(e.button==tbmanyou)

axmap1.currenttool=mapxlib.toolconstants.mipantool;//漫游地图

if(e.button==tbbiaozhu) //标注地图

{

axmap1.currenttool=mapxlib.toolconstants.milabeltool;

//point p=new point(20+55*5,20);

//comu1.show(toolbar2,p);

}

if(e.button==tbtianjiafuhao)

axmap1.currenttool=mapxlib.toolconstants.misymboltool;

if(e.button==tbjuli)

axmap1.currenttool=( mapxlib.toolconstants ) 10;

if(e.button==tbmianji)

axmap1.currenttool=(mapxlib.toolconstants ) 11;

if(e.button==tbshuaxin)

{

//刷新地图,回到初始状态

axmap1.zoomto(this.zoom,this.centerx,this.centery); //恢复初始时的比例

//axmap1.annotations.removeall();

axmap1.refresh();

}

if(e.button==tbxuanze)

{

point p=new point(20,20);

comu.show(toolbar2,p); //显示选择工具菜单,它允许选择矩形,圆形,多边形等

}

}

catch(exception e1)

{

messagebox.show(e1.message);

}

}

#endregion

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » c#中调用mapx5.0(一)-.NET教程,C#语言
分享到: 更多 (0)

相关推荐

  • 暂无文章