previous.frm

来自「这个是我以前做的一个客户管理系统.包内已经含有源码和所用到的控件.代码是用VB写」· FRM 代码 · 共 781 行 · 第 1/2 页

FRM
781
字号
VERSION 5.00
Object = "{7E00A3A2-8F5C-11D2-BAA4-04F205C10000}#1.0#0"; "VSVIEW6.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmPreviewBak 
   Caption         =   "打印预览"
   ClientHeight    =   5340
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8415
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MinButton       =   0   'False
   ScaleHeight     =   5340
   ScaleWidth      =   8415
   Begin VSVIEW6Ctl.VSPrinter vsPreview 
      Height          =   3675
      Left            =   600
      TabIndex        =   5
      Top             =   840
      Width           =   6255
      _cx             =   4205337
      _cy             =   4200786
      Appearance      =   1
      BorderStyle     =   1
      Enabled         =   -1  'True
      MousePointer    =   0
      BackColor       =   -2147483643
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Arial"
         Size            =   11.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty HdrFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Courier New"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _ConvInfo       =   1
      AutoRTF         =   -1  'True
      Preview         =   -1  'True
      DefaultDevice   =   0   'False
      PhysicalPage    =   -1  'True
      AbortWindow     =   -1  'True
      AbortWindowPos  =   0
      AbortCaption    =   "Printing..."
      AbortTextButton =   "Cancel"
      AbortTextDevice =   "on the %s on %s"
      AbortTextPage   =   "Now printing Page %d of"
      FileName        =   ""
      MarginLeft      =   1440
      MarginTop       =   1440
      MarginRight     =   1440
      MarginBottom    =   1440
      MarginHeader    =   0
      MarginFooter    =   0
      IndentLeft      =   0
      IndentRight     =   0
      IndentFirst     =   0
      IndentTab       =   720
      SpaceBefore     =   0
      SpaceAfter      =   0
      LineSpacing     =   100
      Columns         =   1
      ColumnSpacing   =   180
      ShowGuides      =   2
      LargeChangeHorz =   300
      LargeChangeVert =   300
      SmallChangeHorz =   30
      SmallChangeVert =   30
      Track           =   0   'False
      ProportionalBars=   -1  'True
      Zoom            =   18.6274509803922
      ZoomMode        =   3
      ZoomMax         =   400
      ZoomMin         =   10
      ZoomStep        =   5
      MouseZoom       =   2
      MouseScroll     =   -1  'True
      MousePage       =   -1  'True
      EmptyColor      =   -2147483636
      TextColor       =   0
      HdrColor        =   0
      BrushColor      =   0
      BrushStyle      =   0
      PenColor        =   0
      PenStyle        =   0
      PenWidth        =   0
      PageBorder      =   0
      Header          =   ""
      Footer          =   ""
      TableSep        =   "|;"
      TableBorder     =   7
      TablePen        =   0
      TablePenLR      =   0
      TablePenTB      =   0
      HTMLStyle       =   1
   End
   Begin MSComctlLib.StatusBar stb 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   4
      Top             =   5055
      Width           =   8415
      _ExtentX        =   14843
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   3
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            AutoSize        =   1
            Object.Width           =   9208
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Text            =   "页数:"
            TextSave        =   "页数:"
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Text            =   "时间"
            TextSave        =   "时间"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   7410
      Top             =   180
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   9
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":015C
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":0478
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":0794
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":0AB0
            Key             =   ""
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":0DCC
            Key             =   ""
         EndProperty
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":10E8
            Key             =   ""
         EndProperty
         BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":1404
            Key             =   ""
         EndProperty
         BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Previous.frx":1720
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   420
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   8415
      _ExtentX        =   14843
      _ExtentY        =   741
      ButtonWidth     =   609
      ButtonHeight    =   582
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   17
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlSetPrint"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlZoomOut"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlZoomIn"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlFirstPage"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlPrevPage"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlNextPage"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlLastPage"
            ImageIndex      =   7
         EndProperty
         BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlHelp"
            ImageIndex      =   8
         EndProperty
         BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "tlExit"
            Style           =   3
         EndProperty
         BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            ImageIndex      =   9
         EndProperty
      EndProperty
      Begin VB.CommandButton cmdClose 
         Caption         =   "关闭(&C)"
         Height          =   315
         Left            =   5670
         TabIndex        =   3
         Top             =   30
         Width           =   915
      End
      Begin VB.CommandButton cmdPrint 
         Caption         =   "打印(&P)"
         Height          =   315
         Left            =   4500
         TabIndex        =   2
         Top             =   30
         Width           =   915
      End
      Begin VB.TextBox txtPages 
         Height          =   270
         Left            =   2010
         TabIndex        =   1
         Text            =   "1"
         Top             =   60
         Width           =   375
      End
   End
End
Attribute VB_Name = "frmPreviewBak"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private mstrField       As String
Private mbEndLine       As Boolean
Private mbBeginLine     As Boolean

Private Sub mControlSize()

    Dim minHeight       As Integer
    Dim minWidth        As Integer
    Dim EdgeWidth       As Integer
    Dim tlHeight        As Integer
    Dim stbHeight       As Integer
    
    minHeight = 4000
    minWidth = 8000
    EdgeWidth = 80
    tlHeight = IIf(Toolbar1.Visible, Toolbar1.Height, 0)
    stbHeight = IIf(stb.Visible, stb.Height, 0)
    
    If Me.Height < minHeight Then Me.Height = minHeight
    If Me.Width < minWidth Then Me.Width = minWidth
    
    vsPreview.Left = EdgeWidth
    vsPreview.Top = EdgeWidth + tlHeight
    vsPreview.Width = Me.ScaleWidth - EdgeWidth * 2
    vsPreview.Height = Me.ScaleHeight - EdgeWidth * 2 - tlHeight - stbHeight

End Sub

Private Function mstrGetField() As String
'***********************************************************
'
'Purpose:
'        取得标题的字段及调整页边距
'
'***********************************************************

    Dim iCount          As String
    Dim tmpFmt          As String
    Dim tmpField        As String
    Dim iSep            As Integer
    Dim tmpTable        As String
    Dim UsefulWidth     As Integer
    Dim I               As Integer
    Dim EdgeWidth       As Integer
    Dim bOK             As Boolean
    
    On Error GoTo ErrGetField
    
    bOK = False
    iSep = vsPreview.Marginleft
    EdgeWidth = 300
    
    vsPreview.Font.Name = "宋体"
    vsPreview.FontName = "宋体"
    vsPreview.FontSize = 9
    
    If gDataSourceType = 1 Then 'abLvw Then
        iCount = glvwItemData.ColumnHeaders.Count
        Do Until bOK
            tmpFmt = ""
            tmpField = ""
            For I = 1 To iCount
                tmpFmt = tmpFmt & "<+" & vsPreview.TextWidth(glvwItemData.ColumnHeaders(I).Text) + iSep & "|"
                tmpField = tmpField & glvwItemData.ColumnHeaders(I).Text & "|"
            Next I
            tmpFmt = Mid(tmpFmt, 1, Len(tmpFmt) - 1) & ";"
            tmpField = Mid(tmpField, 1, Len(tmpField) - 1) & ";"
            tmpTable = tmpFmt & tmpField
            vsPreview.CalcTable = tmpTable
            
            Do Until False
                UsefulWidth = vsPreview.PageWidth - vsPreview.Marginleft - vsPreview.MarginRight
                If UsefulWidth >= vsPreview.TextWid Then
                    bOK = True
                    Exit Do
                ElseIf UsefulWidth < vsPreview.TextWid And vsPreview.Marginleft > EdgeWidth Then
                    vsPreview.Marginleft = vsPreview.Marginleft / 2
                    vsPreview.MarginRight = vsPreview.MarginRight / 2
                    iSep = iSep / 2
                    bOK = False
                    Exit Do
'                ElseIf VSPreview.MarginLeft <= EdgeWidth And iSep > EdgeWidth Then
'                    iSep = iSep / 2
'                    bOK = False
'                    Exit Do
                ElseIf iSep <= EdgeWidth Then
                    vsPreview.FontSize = vsPreview.FontSize - 1
                    bOK = False
                    Exit Do
'                ElseIf UsefulWidth < VSPreview.TextWid And VSPreview.MarginLeft > EdgeWidth Then
 '                   VSPreview.MarginLeft = VSPreview.MarginLeft / 2
  '                  VSPreview.MarginRight = VSPreview.MarginRight / 2
                Else

⌨️ 快捷键说明

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