This example shows how to use the status bar and progress bar ). After implementation, the result is that In ArcMap, the status bar is located at the bottom of it. It displays information about the current status of ArcMAP, including the progress bar. String 3
L key character string 1
Generally, you can obtain the istatusbar instance through the application instance of ArcMAP, and then obtain the iprogressbar instance through statusbar through GIS, and assign the iprogressbar instance to the istepprogressor type variable. String 4
L program description
String 3
Run the function showprogress to add a status bar (statusbar) and a progress bar (progressbar) to the GPS at the bottom of ArcMap ). String 8
L code
String 8
Sub showprogress () On Error goto err1 Dim pdocument as imxdocument Dim pmap as IMAP Dim player as ilayer Dim pfeaturelayer as ifeaturelayer Dim pfeaturecursor as ifeaturecursor Dim pfeatureclass as ifeatureclass Dim pfeature as ifeature Dim dsum as double Dim lfieldindex as long Dim lnumfeat as long Dim dinterval as double Set pdocument = application. Document Set pmap = pdocument. focusmap Set player = pmap. layer (0) Set pfeaturelayer = player String 7Set pfeatureclass = pfeaturelayer. featureclass Set pfeaturecursor = pfeaturelayer. Search (nothing, true) Dim pstatusbar as istatusbar Set pstatusbar = application. statusbar Dim pstepprogressor as istepprogressor Set pstepprogressor = pstatusbar. progressbar Lnumfeat = pfeatureclass. featurecount (nothing) Dinterval = lnumfeat/100 Set pfeature = pfeaturecursor. nextfeature The 'field name "FID" user changes according to the actual situation Lfieldindex = pfeature. Fields. findfield ("FID ") Dim pausetime, start, finish, totaltime, I Pausetime= 0.5 Pstepprogressor. minrange = 1 Pstepprogressor. maxrange = lnumfeat String 5 Pstepprogressor. stepvalue = dinterval For I = 1 to lnumfeat Dsum = dsum + pfeature. Value (lfieldindex) Set pfeature = nothing Set pfeature = pfeaturecursor. nextfeature Pstepprogressor. Position = I Pstepprogressor. Message = "reading record" & STR (I) & ". Sum =" & STR (dsum) Pstepprogressor. Step Pstepprogressor. Show Start = Timer Do While timer <start + pausetime Doevents Loop string 3 Next Pstepprogressor. Hide Exit sub Err1: Msgbox err. Description End sub |