GettingStartedwithMOinVBWord文件下载.docx

上传人:b****6 文档编号:18344705 上传时间:2022-12-15 格式:DOCX 页数:34 大小:360.68KB
下载 相关 举报
GettingStartedwithMOinVBWord文件下载.docx_第1页
第1页 / 共34页
GettingStartedwithMOinVBWord文件下载.docx_第2页
第2页 / 共34页
GettingStartedwithMOinVBWord文件下载.docx_第3页
第3页 / 共34页
GettingStartedwithMOinVBWord文件下载.docx_第4页
第4页 / 共34页
GettingStartedwithMOinVBWord文件下载.docx_第5页
第5页 / 共34页
点击查看更多>>
下载资源
资源描述

GettingStartedwithMOinVBWord文件下载.docx

《GettingStartedwithMOinVBWord文件下载.docx》由会员分享,可在线阅读,更多相关《GettingStartedwithMOinVBWord文件下载.docx(34页珍藏版)》请在冰豆网上搜索。

GettingStartedwithMOinVBWord文件下载.docx

Use,duplication,anddisclosurebytheU.S.GovernmentaresubjecttorestrictionsassetforthinFAR§

164§

52.227-14AlternateIII(g)(3)(JUN1987),FAR§

52.227-19(JUN1987),DFARS§

252.227-7015(JUN1995)[TechnicalData],and/orDFARS§

252.227-7202(JUN1995)[ComputerSoftware],asapplicable.Contractor/ManufacturerisEnvironmentalSystemsResearchInstitute,Inc.,380NewYorkStreet,Redlands,CA92373-8100USA.

ESRIisaregisteredtrademark,andMapObjects,SpatialDatabaseEngine,SDE,theESRIcorporatelogo,theMapObjectslogo,andGISbyESRIaretrademarksofEnvironmentalSystemsResearchInstitute,Inc.

Thenamesofothercompaniesandproductshereinaretrademarksorregisteredtrademarksoftheirrespectivetrademarkowners.

ContentsIntroduction5

LoadingMapObjects6

Gettinghelp6

Addingamap7

Addingpanandzoomcontrols9

Addingatoolbar11

Creatingafindtool14

Handlingresize16

Displayingmaplayersbasedonscale17

Addingaspatialquerytool18

Statisticalmapping20

Eventtracking21

WorkingwithDataConnectionobjects24

WorkingwithImageLayerobjects25

Congratulations27

GettingStarted

INTHISBOOK

∙LoadingMapObjectsintoVisualBasic

∙Addingsimpledisplaytools

∙Creatingbasicspatialquerytools

∙Displayingmaplayers

∙Trackingevents

∙WorkingwiththeDataConnectionobject

∙Addinganimagelayer

InthisintroductorydocumentyouwilluseMapObjects®

andMicrosoft®

VisualBasic®

tobuildanapplicationthatusesmaps.Alongthewayyouwilllearnhowto:

∙Displayamapwithmultiplelayers.

∙Controlpanningandzooming.

∙Createatoolbarcontrol.

∙Displaymaplayersbasedonscale.

∙Performspatialandlogicalqueries.

∙Drawsimplegraphicsonthemap.

∙Displayfeatureswiththematicrenderers.

∙Dynamicallydisplayreal-timedatawithaneventtrackinglayer.

∙Programmaticallyadddatatoamap.

NoteIfyouacceptedthedefaultswheninstallingMapObjects,thegeographicdatathatthistutorialreferstocanbefoundinC:

\ProgramFiles\ESRI\MapObjects2\Samples\Data\Usa.ThebitmapsyoucanuseareintheSamples\Bitmapsfolder.

LoadingMapObjects

StartVisualBasicandselectNewprojectfromthedialogbox.Nowright-clickonthetoolbox(theleft-hand-sidetoolbar)andchooseAdditionalControls.

Tip:

youcanalsoaddcontrolsbyselectingComponentsfromtheProjectmenu,orbypressingCTRL+T.

Find‘ESRIMapObjects2.2’inthelistofavailablecontrols,andchecktheboxbesideit.ClickOKtoclosethedialog.NoticethatanewtoolappearsintheVisualBasicToolbox.ThisnewtoolistheMapObjectsversion2.2Mapcontrol.

MapObjects

MapControl

Gettinghelp

TheMapcontrolisoneofover45objectsthatmakeupMapObjects.Tofindoutaboutthevariousobjects,clicktheObjectBrowserbuttonintheVisualBasictoolbar.

Pulldownthe“Libraries”combobox,andchooseMapObjects2.

MapObjectsobjectsandconstantsarelistedintheClassesbottomleft-handlist.

Toseethepropertiesandmethodsforanobject,clickontheobjectinthelist.ThepropertiesandmethodsofthatobjectarelistedintheMemberslisttotheright.

Toseethesignatureofamethod,clickonthemethodintheright-handlist.ThedetailswillappearinthespaceatthebottomoftheObjectBrowser.

thesimplestwaytogethelpistoselectthemapcontroland

pressF1.

TheMapObjectsonlinehelpsystemisintegratedwiththeVisualBasicObjectBrowser.

1.ClickSymbolintheClasses/Moduleslist.

2.ClickRotationintheMethods/Propertieslist.

3.Clickthehelp(questionmark)button.

Thehelpsystemprovideshelpforeveryobject,property,method,eventandconstantinMapObjects.InadditiontotheObjectBrowser,thehelpsystemisaccessibleformtheVisualBasicCodewindow.Simplytypeinthenameofanobject,property,method,eventorconstant,andpressF1.

Addingamap

TheMapcontrolistheobjectyouusetodisplaymaps.

AddtheMapcontroltotheform

1.Double-clicktheMapcontrolbuttonintheToolboxtoaddanewmaptotheform.

2.Resizethemaptofilltheform.

Selectthedatatodisplayonthemap

YoucanspecifythedatathatisdisplayedinthemapbysettingpropertiesintheMapcontrol’spropertysheet.

1.Right-clickthemouseonthemaptodisplaythecontextmenu.

2.ChoosePropertiestodisplaythepropertysheet.

3.ClicktheAddbuttonandlocatethefoldercontainingtheStatessampledata.IfyouselectedthedefaultswhenyouinstalledMapObjects,thiswillbeinc:

\ProgramFiles\ESRI\MapObjects2\Samples\Data.

4.ClicktheStates.shpfileandthenclickOpen.

5.AddthefileUSHigh.shpinthesamemanner.

Setpropertiesforthelayers

1.ClicktheStateslayerintheLayerslistandthenclickProperties.

2.ClicktheColorbuttontoselectacolorfortheStateslayer.

3.ClickOKtoclosethedialog.

4.SelectacolorfortheUSHighlayerinthesamemanner.

5.ClickOKtoclosethepropertysheet.

Savetheproject

1.ClicktheFilemenuandthenclickSaveProject.

2.Browsetoasuitablefolder,thenintheFileNameboxtypeStarterMap.frm.

3.ClickSave.

4.InthesecondSavedialog,typeStarterMap.vbpintheFileNamebox.

5.ClickSave.

Run

Testyourapplication

1.ClicktheRunbuttonintheVisualBasictoolbar.

Stop

2.Tostoprunningyourapplicationandreturntodesignmode,clicktheStopbuttonintheVisualBasictoolbar.

Addingpanandzoomcontrols

Atthispointyourapplicationcandisplaythemapatitsfullextent.Inthissectionyouwilladdsomesimplepanandzoomcontrolsthatyourapplicationwillactivateinresponsetomouseclicksinsidethemap.YouwillwritesomecodethattheapplicationwillexecuteinresponsetotheMouseDowneventonthemap.

RespondtotheMouseDownevent

1.Double-clickthemaptodisplaytheVisualBasicCodewindow.

2.AddcodetoMap1’sMouseDownprocedure.

PrivateSubMap1_MouseDown(ButtonAsInteger,_ShiftAsInteger,xAsSingle,yAsSingle)

SetMap1.Extent=Map1.TrackRectangle

EndSub

Testyourchange

2.Clickthemapwiththeleftmousebuttonanddragoutarectangle.

3.Releasethemousebuttonandnoticethatthemapisredrawnatthelocationyouspecified.

TrackRectangleisamethodthatappliestoamap.Ittracksthemovementofthemousewhiletheuserpressesthemousebutton,rubber-bandingarectangleatthesametime.Whentheuserreleasesthemousebutton,theTrackRectanglemethodreturnsaRectangleobjectthattheapplicationassignsintotheExtentpropertyofthemap,causingthemaptoberedrawnwithanewmapextent.

4.ClickthestopbuttoninVisualBasictoreturntodesignmode.

Addpanning

1.Double-clickthemaptodisplaytheVisualBasicCodewindowagain.

2.ChangethecodefortheMouseDownevent.

PrivateSubMap1_MouseDown(ButtonAsInteger,_ShiftAsInteger,xAsSingle,yAsSingle)

IfButton=vbLeftButtonThen

ElseifButton=vbRightButtonthen

Map1.Pan

EndIf

IftheButtonparameterisequaltovbLeftButtonwhentheMouseDowneventoccu

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 职业规划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1