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

📄 frmpreview.frm

📁 超经典的打印预览动态库源码 版权: 本资源版权归作者所有 说明: 本资源由源码天空搜集,仅提供学习参考
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form frmPreview 
   BackColor       =   &H80000004&
   Caption         =   "打印预览"
   ClientHeight    =   6285
   ClientLeft      =   1395
   ClientTop       =   1560
   ClientWidth     =   9000
   Icon            =   "frmPreview.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MinButton       =   0   'False
   ScaleHeight     =   6285
   ScaleWidth      =   9000
   Begin VB.PictureBox picBot 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000000&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   465
      Left            =   315
      ScaleHeight     =   465
      ScaleWidth      =   8115
      TabIndex        =   6
      Top             =   5895
      Width           =   8115
      Begin DllPrint.flatProgressBar prg 
         Height          =   195
         Left            =   765
         TabIndex        =   7
         Top             =   135
         Width           =   735
         _extentx        =   1296
         _extenty        =   344
         font            =   "frmPreview.frx":030A
         borderstyle     =   0
         forecolor       =   128
      End
      Begin VB.Label labInfo 
         Height          =   195
         Left            =   180
         TabIndex        =   9
         Top             =   90
         Width           =   1545
      End
      Begin MSForms.ScrollBar HS 
         Height          =   240
         Left            =   2745
         TabIndex        =   8
         Top             =   90
         Width           =   4065
         Size            =   "7170;423"
      End
   End
   Begin VB.PictureBox picRight 
      AutoRedraw      =   -1  'True
      BorderStyle     =   0  'None
      Height          =   3930
      Left            =   8370
      ScaleHeight     =   3930
      ScaleWidth      =   555
      TabIndex        =   4
      Top             =   900
      Width           =   555
      Begin MSForms.ScrollBar VS 
         Height          =   3705
         Left            =   45
         TabIndex        =   5
         Top             =   45
         Width           =   240
         Size            =   "423;6535"
      End
   End
   Begin VB.PictureBox picTb 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000004&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   690
      Left            =   540
      ScaleHeight     =   690
      ScaleWidth      =   7485
      TabIndex        =   2
      Top             =   -180
      Width           =   7485
      Begin MSComctlLib.Toolbar tbOperate 
         Height          =   330
         Left            =   -315
         TabIndex        =   3
         Top             =   90
         Width           =   7335
         _ExtentX        =   12938
         _ExtentY        =   582
         ButtonWidth     =   1349
         ButtonHeight    =   582
         Style           =   1
         TextAlignment   =   1
         _Version        =   393216
         BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
            NumButtons      =   12
            BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "打印"
               Key             =   "printer"
            EndProperty
            BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Object.Visible         =   0   'False
               Style           =   3
            EndProperty
            BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "输出"
               Key             =   "export"
               Style           =   5
               BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
                  NumButtonMenus  =   4
                  BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Object.Visible         =   0   'False
                  EndProperty
                  BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "jpg"
                     Text            =   "图像(Jpg、Bmp)"
                  EndProperty
                  BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Enabled         =   0   'False
                     Key             =   "html"
                     Text            =   "超文本(Html)"
                  EndProperty
                  BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Enabled         =   0   'False
                     Key             =   "excel"
                     Text            =   "Excel"
                  EndProperty
               EndProperty
            EndProperty
            BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   3
            EndProperty
            BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "设置"
               Key             =   "set"
            EndProperty
            BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "边距"
               Key             =   "margin"
               Style           =   1
            EndProperty
            BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Object.Visible         =   0   'False
               Style           =   3
            EndProperty
            BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "100%"
               Key             =   "zoom"
               Style           =   5
               BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628} 
                  NumButtonMenus  =   10
                  BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "r25"
                     Object.Tag             =   "0.25"
                     Text            =   " 25%"
                  EndProperty
                  BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "r50"
                     Object.Tag             =   "0.5"
                     Text            =   " 50%"
                  EndProperty
                  BeginProperty ButtonMenu3 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "r75"
                     Object.Tag             =   "0.75"
                     Text            =   " 75%"
                  EndProperty
                  BeginProperty ButtonMenu4 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "r100"
                     Object.Tag             =   "1"
                     Text            =   "100%"
                  EndProperty
                  BeginProperty ButtonMenu5 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "r125"
                     Object.Tag             =   "1.25"
                     Text            =   "125%"
                  EndProperty
                  BeginProperty ButtonMenu6 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "r150"
                     Object.Tag             =   "1.5"
                     Text            =   "150%"
                  EndProperty
                  BeginProperty ButtonMenu7 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "r200"
                     Object.Tag             =   "2"
                     Text            =   "200%"
                  EndProperty
                  BeginProperty ButtonMenu8 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "rwidth"
                     Object.Tag             =   "no"
                     Text            =   "页宽"
                  EndProperty
                  BeginProperty ButtonMenu9 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "rpage"
                     Object.Tag             =   "no"
                     Text            =   "整页"
                  EndProperty
                  BeginProperty ButtonMenu10 {66833FEE-8583-11D1-B16A-00C0F0283628} 
                     Key             =   "rdblpage"
                     Object.Tag             =   "no"
                     Text            =   "双页"
                  EndProperty
               EndProperty
            EndProperty
            BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   3
            EndProperty
            BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "帮助"
               Key             =   "help"
            EndProperty
            BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Style           =   3
            EndProperty
            BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Caption         =   "退出"
               Key             =   "quit"
            EndProperty
         EndProperty
         Begin MSComctlLib.ImageList imgIcon 
            Left            =   5760
            Top             =   -135
            _ExtentX        =   1005
            _ExtentY        =   1005
            BackColor       =   -2147483643
            ImageWidth      =   16
            ImageHeight     =   16
            MaskColor       =   12632256
            _Version        =   393216
            BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
               NumListImages   =   7
               BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
                  Picture         =   "frmPreview.frx":032E
                  Key             =   "export"
               EndProperty
               BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
                  Picture         =   "frmPreview.frx":0DF8
                  Key             =   "quit"
               EndProperty
               BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
                  Picture         =   "frmPreview.frx":0F52
                  Key             =   "help"
               EndProperty
               BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
                  Picture         =   "frmPreview.frx":3704
                  Key             =   "margin"
               EndProperty
               BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
                  Picture         =   "frmPreview.frx":3B56
                  Key             =   "printer"
               EndProperty
               BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
                  Picture         =   "frmPreview.frx":6308
                  Key             =   "set"
               EndProperty
               BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
                  Picture         =   "frmPreview.frx":8ABA
                  Key             =   "zoom"
               EndProperty
            EndProperty
         End
      End
   End
   Begin VB.PictureBox picBK 
      Appearance      =   0  'Flat
      BackColor       =   &H00808080&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   5235
      Left            =   180
      MousePointer    =   99  'Custom
      ScaleHeight     =   5235
      ScaleWidth      =   8385
      TabIndex        =   0
      Top             =   630
      Width           =   8385
      Begin VB.PictureBox picPage 
         Appearance      =   0  'Flat
         AutoRedraw      =   -1  'True
         BackColor       =   &H80000005&
         BorderStyle     =   0  'None
         ForeColor       =   &H80000008&
         Height          =   1995
         Index           =   0
         Left            =   90
         ScaleHeight     =   1995
         ScaleWidth      =   1950
         TabIndex        =   1
         Top             =   225
         Visible         =   0   'False
         Width           =   1950
      End
   End
End
Attribute VB_Name = "frmPreview"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Public WithEvents rpt   As Report       '*需要传递进来的Report对象
Attribute rpt.VB_VarHelpID = -1

Private sRate           As Single       '*缩放比例
Private bMargin         As Boolean      '*显示页边距

Private pFrom           As Integer      '*要显示的页起始
Private pTo             As Integer      '*要显示的页终止

Private bInit           As Boolean

Private iPageCnt        As Integer      '*横向显示的页面张数

Private lstX            As Single       '*鼠标按下时X位置
Private lstY            As Single       '*鼠标按下时Y位置

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'*键盘操作支持
    On Error Resume Next
    Select Case KeyCode
        Case vbKeyUp
            VS.Value = VS.Value - 3
        Case vbKeyDown
            VS.Value = VS.Value + 3
        Case vbKeyLeft
            HS.Value = HS.Value - 3
        Case vbKeyRight
            HS.Value = HS.Value + 3
        Case vbKeyPageUp
            VS.Value = VS.Value - 30
        Case vbKeyPageDown
            VS.Value = VS.Value + 30
        Case vbKeyHome
            VS.Value = 0
        Case vbKeyEnd
            VS.Value = VS.Max
    End Select
    On Error GoTo 0
    ShowPage
End Sub

Private Sub Form_Load()
    '*窗体居中
    CenterForm Me
    
    sRate = 1
    Init
    bInit = True
    Me.Show
    bInit = False
    
    prg.Visible = True
    rpt.CalPage
    
    prg.Visible = False

    VS.Value = 0
    HS.Value = 0
    
    iPageCnt = 1
    
    ScrollSet
    ShowPage
    
    picBK.MouseIcon = LoadResPicture("ARROW", vbResCursor)
End Sub


'**************************************************************
'*名称:PrintIt
'*功能:输出一页到PictureBox
'*传入参数:
'*      pic             --PictureBox
'*      page            --页数
'*      cutpage         --分页数
'*      sRate           --比例
'*作者:chlf78
'*日期:2002-04-05 20:04:44
'***************************************************************
Private Sub PrintIt(pic As PictureBox, _
                    page As Integer, _
                    cutpage As Integer, _
                    sRate As Single)
                    
    '*改变PictureBox的大小
    pic.width = rpt.width * sRate
    pic.height = rpt.height * sRate
    pic.Cls
    
    '*输出
    rpt.PrintIt pic, page, cutpage, sRate
    pic.Line (pic.width - 30, 0)-Step(30, pic.height + 30), &H404040, BF
    pic.Line (0, pic.height - 30)-Step(pic.width + 30, 30), &H404040, BF
    If Not bMargin Then
        Exit Sub
    End If
    '*是否要绘制页边距
    With pic
        .ForeColor = &H80000003
        .DrawStyle = 1
        pic.Line (0, rpt.TopMargin * sRate)-Step(rpt.width * sRate, 0)
        pic.Line (rpt.LeftMargin * sRate, 0)-Step(0, rpt.height * sRate)
        pic.Line (0, (rpt.height - rpt.BottomMargin) * sRate)-Step(rpt.width * sRate, 0)
        pic.Line ((rpt.width - rpt.RightMargin) * sRate, 0)-Step(0, rpt.height * sRate)
        pic.DrawStyle = 0
    End With
End Sub

'**************************************************************
'*名称:Init
'*功能:初始化窗口界面
'*传入参数:
'*
'*作者:chlf78
'*日期:2002-04-08 13:40:40
'***************************************************************
Private Sub Init()

    Set tbOperate.ImageList = imgIcon
    With tbOperate
        .left = 180
        .Top = 30
        Dim i       As Integer
        For i = 1 To .Buttons.Count
            If .Buttons(i).Style <> tbrSeparator Then
                .Buttons(i).Image = .Buttons(i).key
            End If
        Next i
    End With
    
    picPage(0).left = 100
    picPage(0).Top = 50
End Sub




'**************************************************************
'*名称:DrawTb
'*功能:绘制工具条的背景图片框
'*传入参数:
'*
'*作者:chlf78
'*日期:2002-04-08 14:32:57
'***************************************************************
Private Sub DrawTb()
On Error Resume Next

⌨️ 快捷键说明

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