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

📄 打印预览.frm

📁 适合乡镇供电所使用电费处理系统v3 软件
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form printview 
   AutoRedraw      =   -1  'True
   Caption         =   "Form1"
   ClientHeight    =   6615
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6660
   LinkTopic       =   "Form1"
   Moveable        =   0   'False
   ScaleHeight     =   6615
   ScaleWidth      =   6660
   StartUpPosition =   3  '窗口缺省
   WindowState     =   2  'Maximized
   Begin VB.Frame Frame1 
      Height          =   7785
      Left            =   15
      TabIndex        =   5
      Top             =   540
      Width           =   11580
      Begin VB.PictureBox Picture1 
         AutoRedraw      =   -1  'True
         BackColor       =   &H80000009&
         BorderStyle     =   0  'None
         Height          =   7485
         Left            =   375
         ScaleHeight     =   7485
         ScaleWidth      =   11070
         TabIndex        =   6
         Top             =   240
         Width           =   11070
      End
   End
   Begin VB.HScrollBar HScroll1 
      Height          =   225
      Left            =   45
      TabIndex        =   4
      Top             =   8370
      Width           =   11535
   End
   Begin VB.VScrollBar VScroll1 
      Height          =   7575
      Left            =   11640
      TabIndex        =   3
      Top             =   645
      Width           =   225
   End
   Begin MSComDlg.CommonDialog prtDlg 
      Left            =   5880
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command2 
      Caption         =   "打印机设置"
      Height          =   390
      Left            =   3135
      TabIndex        =   2
      Top             =   120
      Width           =   1125
   End
   Begin VB.CommandButton Command1 
      Caption         =   "打印表格"
      Height          =   390
      Left            =   1650
      TabIndex        =   1
      Top             =   120
      Width           =   1215
   End
   Begin VB.CommandButton ComPaint 
      Caption         =   "预  览"
      Height          =   405
      Left            =   90
      TabIndex        =   0
      Top             =   105
      Width           =   1260
   End
End
Attribute VB_Name = "printview"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim l_RowHeight As Single   '行高
Dim l_ColWidth As Single   '列宽
Dim l_StarCol As Single  '开始列坐标
Dim l_StarRow As Single  '开始行坐标
Dim l_Rows As Integer   '行数
Dim l_Cols As Integer   '列数

Private Sub Command1_Click()
   Printer.CurrentX = 0
   Printer.CurrentY = 0
   Printer.Print " "
   Call DrawFlowToObject(Printer)
   Printer.EndDoc
   
End Sub

Private Sub Command2_Click()
   prtDlg.Flags = &H10 Or &H40
   prtDlg.Action = 5
End Sub

Private Sub ComPaint_Click()
   Call DrawFlowToObject(Picture1)
End Sub

Private Sub Form_Activate()
   Call ComPaint_Click
End Sub

Private Sub Form_Load()
   Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
   l_Rows = 22
   l_Cols = 8
   l_RowHeight = 8
   l_ColWidth = 20
   l_StarCol = 5
   l_StarRow = 10
   Picture1.ScaleMode = 6
   Picture1.Width = Frame1.Width
   Picture1.Height = 15000
   Picture1.Top = 2
   Picture1.Left = 2
   VScroll1.Max = Picture1.Height
End Sub

Private Sub HScroll1_Change()
   Picture1.Left = 0 - HScroll1.Value
   Picture1.Cls
   Call ComPaint_Click

End Sub

Private Sub VScroll1_Change()
   Picture1.Top = 0 - VScroll1.Value
   Picture1.Cls
   Call ComPaint_Click
End Sub

Private Sub DrawFlowToObject(outObject As Object)
   Dim l_I As Long
   outObject.ScaleMode = 6
   With outObject
        
        .Font.Name = "宋体"
        .Font.Size = 16
        .Font.Bold = True
        .CurrentX = l_StarCol + 10 '列
        .CurrentY = l_StarRow - 4   '行
         outObject.Print "  萧山市供电局新湾镇电管站一号村电费清单"
        
        .CurrentX = l_StarCol + 10
        .CurrentY = l_StarRow + 10
        .Font.Size = 10
        .Font.Bold = False
        outObject.Print "               单位名称:" & "一号村" & "                             日期:" & Date
        
        '画方框
        For l_I = 0 To l_Cols
           outObject.Line (l_StarCol + l_I * l_ColWidth, l_StarRow + 20)-(l_StarCol + l_I * l_ColWidth, l_StarRow + 20 + l_Rows * l_RowHeight), , BF
        Next
        
        For l_I = 0 To l_Rows
           outObject.Line (l_StarCol, l_StarRow + 20 + l_RowHeight * l_I)-(l_StarCol + l_Cols * l_ColWidth, l_StarRow + 20 + l_I * l_RowHeight), , BF
        Next
        '打表头
        For l_I = 0 To (l_Cols / 2) - 1
           .CurrentX = l_StarCol + l_I * l_ColWidth * 2 + 6
           .CurrentY = l_StarRow + 20 + 2
           outObject.Print "姓 名"
           .CurrentY = l_StarRow + 20 + 2
           .CurrentX = l_StarCol + l_I * l_ColWidth * 2 + l_ColWidth + 1
           
           outObject.Print " 本月电费"
        Next
           .CurrentY = l_StarRow + 200
           .CurrentX = l_StarCol    '+ l_I * l_ColWidth * 2 + l_ColWidth + 1
             
        outObject.Print "本页户数 "
        '下面开始打印
        '........
        
  End With

End Sub

⌨️ 快捷键说明

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