- Geography 5224 -
Project 3: Intro to Programming ArcObjects (Week 2)

Objective:
learn about programming tools that allow one to develop truly sophisticated customizations in ArcView;
work with collections of objects; control program flow with conditional statements and loops;
learn about improving readability of code; learn the controls on the VB editor interface;
break code into modules to enhance reusability



The ArcMap dialog box above alerts the GIS user to the fact that the scale
of the current map is at 44112081...

Additional code was written to create a message in the status bar on the lower left of the user interface
that states: 'Scale changed from __ to __.'

Public Sub ScaleChange(intScale As Integer)

Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument

Dim pActiveView As IActiveView
Set pActiveView = pMxDoc.ActiveView

Dim pEnv As IEnvelope
Set pEnv = pActiveView.Extent

Dim pMap As IMap
Set pMap = pMxDoc.FocusMap

Dim dblMapScale1 As Double
dblMapScale1 = pMap.MapScale

pEnv.Expand intScale, intScale, True

pActiveView.Extent = pEnv
pActiveView.Refresh

Dim pStatusBar As IStatusBar
Set pStatusBar = Application.StatusBar

Dim dblMapScale2 As Double
dblMapScale2 = pMap.MapScale

Dim strMessage As String
pStatusBar.Message(0) = "Scale changed from " & dblMapScale1 & " to " & dblMapScale2

pStatusBar.Message(0) = strMessage

End Sub

back to gis coursework