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

📄 vba16-4.txt

📁 AO的原代码,都是以TXT的文件写的,对你肯定有帮助的.这些都是 我的心血啊.
💻 TXT
字号:
Private Function SetPageSize() As Boolean
    ' Show the page size choices and
    ' set the page size based on the
    ' user's selection.
    Dim pMxDocument As IMxDocument
    Dim pPageLayout As IPageLayout
    Dim pPage As IPage
    Dim pListDialog As IListDialog
    Dim pCoordinateDialog As ICoordinateDialog
    Dim blnOK As Boolean
    Dim dblWidth As Double
    Dim dblHeight As Double
    Dim vResponse As Variant
    ' Access the page object.
    Set pMxDocument = Application.Document
    Set pPageLayout = pMxDocument.PageLayout
    Set pPage = pPageLayout.Page
    ' List the page size and orientation
    ' choices.
    Set pListDialog = New ListDialog
    pListDialog.AddString "Letter - Portrait"
    pListDialog.AddString "Letter - Landscape"
    pListDialog.AddString "Legal - Portrait"
    pListDialog.AddString "Legal - Landscape"
    pListDialog.AddString "C - Portrait"
    pListDialog.AddString "C - Landscape"
    pListDialog.AddString "D - Portrait"
    pListDialog.AddString "D - Landscape"
    pListDialog.AddString "E - Portrait"
    pListDialog.AddString "E - Landscape"
    pListDialog.AddString "Custom Page Size"
    blnOK = pListDialog.DoModal _
    ("Select a page size and orientation", 0, 0)
    If Not blnOK Then
        SetPageSize = False
        Exit Function
    End If
    ' Apply the selected page size
    ' and orientation.
    Select Case pListDialog.Choice
        Case 0
            ' Letter - Portrait
            pPage.FormID = esriPageFormLetter
            pPage.Orientation = 1
        Case 1
            ' Letter - Landscape
            pPage.FormID = esriPageFormLetter
            pPage.Orientation = 2
        Case 2
            ' Legal - Portrait
            pPage.FormID = esriPageFormLegal
            pPage.Orientation = 1
        Case 3
            ' Legal - Landscape
            pPage.FormID = esriPageFormLegal
            pPage.Orientation = 2
        Case 4
            ' C - Portrait
            pPage.FormID = esriPageFormC
            pPage.Orientation = 1
        Case 5
            ' C - Landscape
            pPage.FormID = esriPageFormC
            pPage.Orientation = 2
        Case 6
            ' D - Portrait
            pPage.FormID = esriPageFormD
            pPage.Orientation = 1
        Case 7
            ' D - Landscape
            pPage.FormID = esriPageFormD
            pPage.Orientation = 2
        Case 8
            ' E - Portrait
            pPage.FormID = esriPageFormE
            pPage.Orientation = 1
        Case 9
            ' E - Landscape
            pPage.FormID = esriPageFormE
            pPage.Orientation = 2
        Case 10
            ' Custom Page Size
            ' Get the page size from the user.
            Set pCoordinateDialog = New CoordinateDialog
            Do
                ' Use a loop in case the user
                ' has to re-enter the page size.
                blnOK = pCoordinateDialog.DoModal _
                ("Width & Height (inches)", 8.5, 11, 2, 0)
                If Not blnOK Then
                    SetPageSize = False
                    Exit Function
                End If
                dblWidth = pCoordinateDialog.X
                dblHeight = pCoordinateDialog.Y
                If dblWidth < 5 Or dblHeight < 5 Then
                    vResponse = MsgBox _
                    ("Page width or height cannot " & _
                    "be less than 5 inches", _
                    vbExclamation + vbOKCancel)
                    If vResponse = vbCancel Then
                        SetPageSize = False
                        Exit Function
                    End If
                Else
                    Exit Do
                End If
            Loop
            pPage.Units = esriInches
            pPage.PutCustomSize pCoordinateDialog.X, _
            pCoordinateDialog.Y
    End Select
    ' Done
    SetPageSize = True
End Function

⌨️ 快捷键说明

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