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

📄 printviewwin.frm

📁 汽车维修管理软件。其中包含三个编辑控件。
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form PrintViewWin 
   BackColor       =   &H8000000C&
   Caption         =   "预览"
   ClientHeight    =   5385
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7035
   LinkTopic       =   "Form1"
   ScaleHeight     =   5385
   ScaleWidth      =   7035
   WindowState     =   2  'Maximized
   Begin MSComctlLib.Toolbar Toolbar 
      Align           =   1  'Align Top
      Height          =   630
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7035
      _ExtentX        =   12409
      _ExtentY        =   1111
      ButtonWidth     =   820
      ButtonHeight    =   953
      AllowCustomize  =   0   'False
      Appearance      =   1
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   10
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "打印"
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   4
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "首页"
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "上页"
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "下页"
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "后页"
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   4
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "设置"
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   4
            Object.Width           =   3000
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退出"
         EndProperty
      EndProperty
      Begin VB.TextBox Label 
         Appearance      =   0  'Flat
         BackColor       =   &H80000004&
         BorderStyle     =   0  'None
         CausesValidation=   0   'False
         Enabled         =   0   'False
         Height          =   270
         Left            =   3240
         ScrollBars      =   1  'Horizontal
         TabIndex        =   5
         Text            =   "放大比例"
         Top             =   120
         Width           =   975
      End
      Begin VB.ComboBox Combo 
         BackColor       =   &H80000009&
         Height          =   300
         ItemData        =   "PrintViewWin.frx":0000
         Left            =   4320
         List            =   "PrintViewWin.frx":0010
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   120
         Width           =   1335
      End
   End
   Begin VB.HScrollBar HScroll 
      Height          =   255
      Left            =   0
      TabIndex        =   3
      Top             =   5160
      Width           =   6975
   End
   Begin VB.VScrollBar VScroll 
      Height          =   4575
      Left            =   6720
      TabIndex        =   2
      Top             =   600
      Width           =   255
   End
   Begin VB.PictureBox m_Picture 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   4215
      Left            =   600
      ScaleHeight     =   4185
      ScaleWidth      =   9975
      TabIndex        =   1
      Top             =   1200
      Width           =   10000
   End
End
Attribute VB_Name = "PrintViewWin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private m_PaintRate As Double
Private m_Page As Long
Private m_MaxPage As Long
Private m_PageWidht As Long
Private m_PageHeight As Long
Public Event PaintPage(ByVal pPage As Long, ByVal pPaintRate As Double)
Public Event DoPrint()
Private Sub Combo_Validate(Cancel As Boolean)
Select Case Combo.ListIndex
       Case 0
            m_PaintRate = 2
       Case 1
            m_PaintRate = 1
       Case 2
            m_PaintRate = 0.75
       Case 3
            m_PaintRate = 0.5
End Select
SetPageRate
m_Picture.Cls
RaiseEvent PaintPage(m_Page, m_PaintRate)
End Sub

Private Sub Form_Initialize()
m_MaxPage = 1
End Sub

Private Sub Form_Load()

m_PaintRate = 1
m_PageWidht = Printer.Width ' * 0.7
m_Picture.Width = m_PageWidht * 0.7
m_PageHeight = Printer.Height ' * 0.7
m_Picture.Height = m_PageHeight * 0.7
VScroll.Max = m_Picture.Height / 1000
HScroll.Max = m_Picture.Width / 1000
Combo.ListIndex = 1
m_Page = 1
If m_MaxPage = 1 Then
   Toolbar.Buttons.Item(3).Enabled = False
   Toolbar.Buttons.Item(4).Enabled = False
   Toolbar.Buttons.Item(5).Enabled = False
   Toolbar.Buttons.Item(6).Enabled = False
Else
   Toolbar.Buttons.Item(3).Enabled = False
   Toolbar.Buttons.Item(4).Enabled = False
   Toolbar.Buttons.Item(5).Enabled = True
   Toolbar.Buttons.Item(6).Enabled = True
End If
End Sub

Private Sub Form_Resize()
If Me.Width > 360 Then VScroll.Left = Me.Width - 360
VScroll.Top = Toolbar.Height
If Me.Height > Toolbar.Height + 400 Then VScroll.Height = Me.Height - Toolbar.Height - 400
HScroll.Left = 0
If Me.Width > VScroll.Width + 100 Then HScroll.Width = Me.Width - VScroll.Width - 100
If Me.Height > Toolbar.Height + 20 Then HScroll.Top = Me.Height - Toolbar.Height - 20 ' - HScroll.Height
End Sub

Private Sub HScroll_Change()
m_Picture.Move 600 - HScroll.Value * 1000
End Sub

Private Sub m_Picture_Paint()

RaiseEvent PaintPage(m_Page, m_PaintRate)
End Sub

Private Sub Toolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
       Case 1
            RaiseEvent DoPrint
       Case 3
            m_Page = 1
            Button.Enabled = False
            Toolbar.Buttons.Item(4).Enabled = False
            Toolbar.Buttons.Item(5).Enabled = True
            Toolbar.Buttons.Item(6).Enabled = True
       Case 4
            If m_Page > 1 Then
               m_Page = m_Page - 1
               If m_Page = 1 Then
                  Toolbar.Buttons.Item(3).Enabled = False
                  Toolbar.Buttons.Item(4).Enabled = False
                  Toolbar.Buttons.Item(5).Enabled = True
                  Toolbar.Buttons.Item(6).Enabled = True
               Else
                  Toolbar.Buttons.Item(3).Enabled = True
                  Toolbar.Buttons.Item(4).Enabled = True
                  Toolbar.Buttons.Item(5).Enabled = True
                  Toolbar.Buttons.Item(6).Enabled = True
               End If
            End If
       Case 5
            If m_Page < m_MaxPage Then
               m_Page = m_Page + 1
               If m_Page = m_MaxPage Then
                  Toolbar.Buttons.Item(3).Enabled = True
                  Toolbar.Buttons.Item(4).Enabled = True
                  Toolbar.Buttons.Item(5).Enabled = False
                  Toolbar.Buttons.Item(6).Enabled = False
               Else
                  Toolbar.Buttons.Item(3).Enabled = True
                  Toolbar.Buttons.Item(4).Enabled = True
                  Toolbar.Buttons.Item(5).Enabled = True
                  Toolbar.Buttons.Item(6).Enabled = True
               End If
            End If
       Case 6
            m_Page = m_MaxPage
            Button.Enabled = False
            Toolbar.Buttons.Item(3).Enabled = True
            Toolbar.Buttons.Item(4).Enabled = True
            Toolbar.Buttons.Item(5).Enabled = False
       Case 8
            
       Case 10
            Unload Me
End Select
m_Picture.Cls
RaiseEvent PaintPage(m_Page, m_PaintRate)
End Sub

Private Sub VScroll_Change()
m_Picture.Move 600 - HScroll.Value * 1000, 1200 - VScroll.Value * 1000
End Sub

Public Property Get PaintRate() As Double
PaintRate = m_PaintRate
End Property



Public Property Get Page() As Long
Page = m_Page
End Property



Public Property Get MaxPage() As Long
MaxPage = m_MaxPage
End Property

Public Property Let MaxPage(ByVal vNewValue As Long)
m_MaxPage = vNewValue
End Property
Private Sub SetPageRate()
m_Picture.Width = m_PageWidht * m_PaintRate * 0.7
m_Picture.Height = m_PageHeight * m_PaintRate * 0.7
End Sub


Public Property Get PageWidht() As Long
PageWidht = m_PageWidht
End Property



Public Property Get PageHeight() As Variant
PageHeight = m_PageHeight
End Property



Public Property Get PrintView() As Variant
Set PrintView = m_Picture
End Property

⌨️ 快捷键说明

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