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

📄 frm_preview.frm

📁 汽修厂管理软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm_PreView 
   BackColor       =   &H80000004&
   Caption         =   "打印预览"
   ClientHeight    =   9300
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   12225
   Icon            =   "Frm_PreView.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   9300
   ScaleWidth      =   12225
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Cmd_This 
      Caption         =   "打印当前页"
      Height          =   375
      Left            =   2280
      TabIndex        =   8
      Top             =   8400
      Width           =   1095
   End
   Begin VB.PictureBox Pic 
      Height          =   7935
      Left            =   120
      ScaleHeight     =   7875
      ScaleWidth      =   11835
      TabIndex        =   6
      Top             =   120
      Width           =   11895
      Begin VB.PictureBox Pic_Show 
         Appearance      =   0  'Flat
         AutoRedraw      =   -1  'True
         BackColor       =   &H00FFFFFF&
         ForeColor       =   &H80000008&
         Height          =   3135
         Left            =   120
         ScaleHeight     =   3105
         ScaleWidth      =   4905
         TabIndex        =   7
         Top             =   120
         Width           =   4935
      End
   End
   Begin VB.CommandButton Cmd_Last 
      Caption         =   "最后一页"
      Height          =   375
      Left            =   10320
      TabIndex        =   5
      Top             =   8400
      Width           =   1215
   End
   Begin VB.CommandButton Cmd_First 
      Caption         =   "第一页"
      Height          =   375
      Left            =   5520
      TabIndex        =   4
      Top             =   8400
      Width           =   1215
   End
   Begin VB.CommandButton Cmd_Previous 
      Caption         =   "上一页"
      Height          =   375
      Left            =   7200
      TabIndex        =   3
      Top             =   8400
      Width           =   1215
   End
   Begin VB.CommandButton Cmd_Next 
      Caption         =   "下一页"
      Height          =   375
      Left            =   8880
      TabIndex        =   2
      Top             =   8400
      Width           =   1095
   End
   Begin VB.CommandButton Cmd_Exit 
      Caption         =   "退出"
      Height          =   375
      Left            =   3840
      TabIndex        =   1
      Top             =   8400
      Width           =   1215
   End
   Begin VB.CommandButton Cmd_Print 
      Caption         =   "打印"
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   8400
      Width           =   1215
   End
End
Attribute VB_Name = "Frm_PreView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public intRows As Integer
Public strHeader As String
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public MPrint As FlexPrinter
Public MGrid As MSFlexGrid
Dim CurPage As Integer
Dim TotalPage As Integer

Private Sub Cmd_Exit_Click()
Unload Me
End Sub

Private Sub Cmd_First_Click()
Pic_Show.Cls
MPrint.CurPage = 1
MPrint.PrintOut Pic_Show
CmdBoxSetup

End Sub

Private Sub Cmd_Last_Click()
Pic_Show.Cls
MPrint.CurPage = MPrint.TotalPages
MPrint.PrintOut Pic_Show
CmdBoxSetup

End Sub

Private Sub Cmd_Next_Click()
Pic_Show.Cls
MPrint.CurPage = MPrint.CurPage + 1
MPrint.PrintOut Pic_Show
CmdBoxSetup

End Sub

Private Sub Cmd_Previous_Click()
Pic_Show.Cls
MPrint.CurPage = MPrint.CurPage - 1
MPrint.PrintOut Pic_Show
CmdBoxSetup

End Sub

Private Sub Cmd_Print_Click()
With MPrint
Do
 .PrintOut Printer
 .CurPage = .CurPage + 1
 Printer.EndDoc
Loop Until .CurPage = .TotalPages + 1
End With


End Sub

Private Sub Cmd_This_Click()
With MPrint
.PrintOut Printer
Printer.EndDoc
End With
End Sub

Private Sub Form_Load()
Pic_Show.Width = Printer.Width - 100
Pic_Show.Height = Printer.Height - 100
Printer.ScaleMode = vbPixels
Set MPrint = New FlexPrinter
Set MPrint.FlexName = MGrid
MPrint.CurPage = 1
MPrint.Header = strHeader

MPrint.Footer = STRGRGINFO
With MPrint
.PosTop = 90
.PosLeft = 50

.HSpace = 0
.VSpace = 0

.RoundCorX = 10
.RoundCorY = 10

.GridPenStyle = 0
.bGridPrint = True
.bDrawBoarder = True
.BoarderColor = 0
.BoarderStyle = 0
.BoarderWidth = 1
.BoarderDistance = 5

.PrintOut Pic_Show

End With

Cmd_First.Enabled = False
Cmd_Previous.Enabled = False
CmdBoxSetup
'Frm_PreView.FlxPreview.RowsTo = Grid_History.Rows - 1
'Frm_PreView.FlxPreview.PrintOut Frm_PreView.Pic_Show
End Sub

Private Sub PIC_show_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
        ReleaseCapture
        Call SendMessage(Pic_Show.hwnd, &H112, &HF012, 0)
End If

End Sub


Sub CmdBoxSetup()
With MPrint
 If .CurPage = .TotalPages Then
  Cmd_Next.Enabled = False
  Cmd_Last.Enabled = False
 Else
  Cmd_Next.Enabled = True
  Cmd_Last.Enabled = True
 
 End If
 If .CurPage = 1 Then
  Cmd_First.Enabled = False
  Cmd_Previous.Enabled = False
  Else
  Cmd_First.Enabled = True
  Cmd_Previous.Enabled = True
 End If


End With


End Sub

⌨️ 快捷键说明

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