指定した回数だけ ExtentStack を戻す

投稿日:2016/9/1 (木) 更新日:

Sub GetBackExtentStackNET()
        Dim pMxDocument As IMxDocument = My.ArcMap.Document
        Dim pActiveView As IActiveView = pMxDocument.ActiveView
        Dim pExtentStack As IExtentStack = pActiveView.ExtentStack
 
        MsgBox("スタックされているエクステントの数:" & pExtentStack.Count.ToString())
 
        Dim num As Long
        num = Long.Parse(InputBox("スタックを戻す回数を入力", "", "10"))    'スタックを戻す回数
 
        Dim i As Long
        For i = 1 To pExtentStack.Count - num
 
            If Not pExtentStack.CanUndo = False Then
                pExtentStack.Undo()
            End If
 
        Next i
 
        pActiveView.Extent = pActiveView.Extent '現在の範囲をセットしてRedoをさせない対処
        pActiveView.Refresh()
 
End Sub
 
Sub GetBackExtentStack()
     
    Dim num As Long
    num = 10    'スタックを戻す回数
 
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
     
    Dim pActiveView As IActiveView
    Set pActiveView = pMxDocument.ActiveView
     
    Dim pExtentStack As IExtentStack
    Set pExtentStack = pActiveView.ExtentStack
     
    Debug.Print pExtentStack.Count
     
    Dim i As Long
    For i = 1 To pExtentStack.Count - num
     
        If Not pExtentStack.CanUndo = False Then
            pExtentStack.Undo
        End If
     
    Next i
     
    pActiveView.Extent = pActiveView.Extent '現在の範囲をセットしてRedoをさせない対処
    pActiveView.Refresh
 
End Sub

関連記事

-プログラミング, ArcGIS
-, ,

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.