⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vba16-5.txt

📁 AO的原代码,都是以TXT的文件写的,对你肯定有帮助的.这些都是 我的心血啊.
💻 TXT
字号:
Public Function PlaceDetailMapFrame() As IElement
    ' Position the existing detail map frame
    ' in the upper left corner.
    Dim pMxDocument As IMxDocument
    Dim pPageLayout As IPageLayout
    Dim pPage As IPage
    Dim pActiveView As IActiveView
    Dim dblPageWidth As Double
    Dim dblPageHeight As Double
    Dim dblMargin As Double
    Dim dblFrameWidth As Double
    Dim dblFrameHeight As Double
    Dim pElement As IElement
    Dim pEnvelope As IEnvelope
    Dim pMapFrame As IMapFrame
    Dim pTransform2d As ITransform2D
    Dim pPoint As IPoint
    Dim dblXMove As Double
    Dim dblYMove As Double
    ' Get the page size.
    Set pMxDocument = Application.Document
    Set pPageLayout = pMxDocument.PageLayout
    Set pActiveView = pPageLayout
    Set pPage = pPageLayout.Page
    pPage.QuerySize dblPageWidth, dblPageHeight
    dblMargin = c_dblMargin
    ' Calculate the map frame's new size.
    ' Frame width and height are the page width
    ' or height less the margin and less two
    ' inches for other frames.
    dblFrameWidth = dblPageWidth - (2 * dblMargin + 2)
    dblFrameHeight = dblPageHeight - (2 * dblMargin + 2)
    ' Access the map frame.
    Set pElement = GetMapFrameByName("DETAIL")
    If pElement Is Nothing Then
        MsgBox "Missing Detail map."
        Set PlaceDetailMapFrame = Nothing
        Exit Function
    End If
    ' Get the map frame's current size.
    Set pEnvelope = New Envelope
    pElement.QueryBounds pActiveView.ScreenDisplay, _
    pEnvelope
    ' Map frame should show the map
    ' at its current scale.
    Set pMapFrame = pElement
    pMapFrame.ExtentType = esriExtentDefault
    ' Resize and move the detail map frame.
    Set pTransform2d = pMapFrame
    Set pPoint = New Point
    pPoint.X = pEnvelope.XMin
    pPoint.Y = pEnvelope.YMax
    With pTransform2d
        .Scale pPoint, dblFrameWidth / pEnvelope.Width, _
        dblFrameHeight / pEnvelope.Height
    End With
    dblXMove = dblMargin - pEnvelope.XMin
    dblYMove = (dblPageHeight - dblMargin) - _
    pEnvelope.YMax
    pTransform2d.Move dblXMove, dblYMove
    ' Done
    Set PlaceDetailMapFrame = pElement
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -