自定义缩放图层

Private Sub ComboBox1_Change()
    Dim pMxDoc As IMxDocument
    Set pMxDoc = Application.Document
    Dim pActiveView As IActiveView
    Set pActiveView = pMxDoc.activeView
    Dim pEnvelop As IEnvelope
    Set pEnvelop = pActiveView.Extent
   
    Select Case Me.ComboBox1.Text
        Case "10%"
          pEnvelop.Expand 0.1, 0.1, True
        Case "20%"
          pEnvelop.Expand 0.25, 0.25, True
        Case "50%"
          pEnvelop.Expand 0.5, 0.5, True
        Case "75%"
          pEnvelop.Expand 0.75, 0.75, True
        Case "125%"
          pEnvelop.Expand 1.25, 1.25, True
        Case "150%"
          pEnvelop.Expand 1.5, 1.5, True
        Case "200%"
          pEnvelop.Expand 2, 2, True
        Case "500%"
          pEnvelop.Expand 5, 5, True
        Case "1000%"
          pEnvelop.Expand 10, 10, True
        Case Else
          pEnvelop.Expand 1, 1, True
    End Select
   
    pActiveView.Extent = pEnvelop
    pActiveView.Refresh
End Sub

 


Private Sub UserForm_Activate()
    Me.ComboBox1.AddItem "10%"
    Me.ComboBox1.AddItem "25%"
    Me.ComboBox1.AddItem "50%"
    Me.ComboBox1.AddItem "75%"
    Me.ComboBox1.AddItem "100%"
    Me.ComboBox1.AddItem "125%"
    Me.ComboBox1.AddItem "150%"
    Me.ComboBox1.AddItem "200%"
    Me.ComboBox1.AddItem "500%"
    Me.ComboBox1.AddItem "1000%"
End Sub

 

IEnvelope.Expand(dx,dy,asRatio)方法中当asRatio为true时,帮助文档上的算法为:
xmax=(xmax+dx*width)/2
xmin=(xmin-dx*width)/2

posted @ 2008-09-18 09:34  zhh  阅读(298)  评论(0编辑  收藏  举报