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

📄 frmexport2printer.frm

📁 ktv场所的包房开房、迎宾、预定管理系统。
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmExport2Prn 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "输出到打印机"
   ClientHeight    =   2850
   ClientLeft      =   2670
   ClientTop       =   3015
   ClientWidth     =   5625
   Icon            =   "frmExport2Printer.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2850
   ScaleWidth      =   5625
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   285
      Left            =   4455
      TabIndex        =   4
      Top             =   2520
      Width           =   1000
   End
   Begin VB.CommandButton cmdExport 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   285
      Left            =   3330
      TabIndex        =   3
      Top             =   2520
      Width           =   1000
   End
   Begin VB.Frame Frame1 
      Height          =   2400
      Left            =   135
      TabIndex        =   5
      Top             =   45
      Width           =   5325
      Begin VB.PictureBox flatProgressBar1 
         Height          =   285
         Left            =   780
         ScaleHeight     =   225
         ScaleWidth      =   4365
         TabIndex        =   18
         Top             =   2010
         Width           =   4425
      End
      Begin VB.ComboBox cmbCutPageTo 
         Height          =   315
         Left            =   2835
         Style           =   2  'Dropdown List
         TabIndex        =   15
         Top             =   1170
         Width           =   1095
      End
      Begin VB.ComboBox cmbPageTo 
         Height          =   315
         Left            =   810
         Style           =   2  'Dropdown List
         TabIndex        =   14
         Top             =   1170
         Width           =   1095
      End
      Begin VB.ComboBox cmbCutPageFrom 
         Height          =   315
         Left            =   2835
         Style           =   2  'Dropdown List
         TabIndex        =   13
         Top             =   720
         Width           =   1095
      End
      Begin VB.ComboBox cmbPageFrom 
         Height          =   315
         Left            =   810
         Style           =   2  'Dropdown List
         TabIndex        =   11
         Top             =   720
         Width           =   1095
      End
      Begin MSComDlg.CommonDialog dlg 
         Left            =   4320
         Top             =   1080
         _ExtentX        =   847
         _ExtentY        =   847
         _Version        =   393216
      End
      Begin VB.CommandButton cmdSet 
         Caption         =   "设置..."
         Height          =   285
         Left            =   4230
         TabIndex        =   10
         Top             =   630
         Width           =   870
      End
      Begin VB.CheckBox chkFit 
         Caption         =   "适应打印机纸张"
         Height          =   195
         Left            =   2340
         TabIndex        =   2
         Top             =   1665
         Width           =   1635
      End
      Begin VB.TextBox txtRate 
         Alignment       =   2  'Center
         Height          =   285
         Left            =   810
         TabIndex        =   1
         Text            =   "100"
         Top             =   1620
         Width           =   780
      End
      Begin VB.ComboBox cmbPrinter 
         Height          =   315
         Left            =   810
         Style           =   2  'Dropdown List
         TabIndex        =   0
         Top             =   270
         Width           =   4290
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "进度"
         Height          =   195
         Left            =   315
         TabIndex        =   17
         Top             =   2040
         Width           =   360
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   180
         Picture         =   "frmExport2Printer.frx":000C
         Stretch         =   -1  'True
         Top             =   180
         Width           =   435
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "分页"
         Height          =   195
         Left            =   2340
         TabIndex        =   16
         Top             =   1215
         Width           =   360
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "分页"
         Height          =   195
         Left            =   2340
         TabIndex        =   12
         Top             =   780
         Width           =   360
      End
      Begin VB.Label Label6 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         Caption         =   "缩放"
         ForeColor       =   &H80000008&
         Height          =   195
         Left            =   315
         TabIndex        =   9
         Top             =   1665
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "页起始"
         Height          =   195
         Left            =   135
         TabIndex        =   8
         Top             =   780
         Width           =   540
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "到"
         Height          =   180
         Left            =   495
         TabIndex        =   7
         Top             =   1215
         Width           =   180
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "%"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   240
         Left            =   1800
         TabIndex        =   6
         Top             =   1620
         Width           =   120
      End
   End
End
Attribute VB_Name = "frmExport2Prn"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Public WithEvents rpt           As report       '*需要传递进来的报表类
Attribute rpt.VB_VarHelpID = -1

Private Sub chkFit_Click()
    If chkFit.Value = 1 Then
        txtRate.Enabled = False
    Else
        txtRate.Enabled = True
    End If
End Sub

Private Sub cmdSet_Click()
    
    With dlg
        .CancelError = False
        .Flags = &H40
        .ShowPrinter
    End With

End Sub

Private Sub Form_Load()
    
    CenterForm Me
    
    Dim prn     As Printer

    For Each prn In Printers
        cmbPrinter.AddItem prn.DeviceName
    Next
    
    cmbPrinter.text = Printer.DeviceName
    Dim i           As Integer
    With rpt
        For i = 1 To .pages
            cmbPageFrom.AddItem i
            cmbPageTo.AddItem i
        Next i
        For i = 1 To .cutpages
            cmbCutPageFrom.AddItem i
            cmbCutPageTo.AddItem i
        Next i
        cmbPageFrom.text = 1
        cmbPageTo.text = .pages
        cmbCutPageFrom.text = 1
        cmbCutPageTo.text = .cutpages
    End With
    
    InitText txtRate, 0
End Sub


Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdExport_Click()
    
    On Error GoTo err_other
    
    If cmbPageFrom.text > cmbPageTo.text Then
        Exit Sub
    End If
    
    Dim sRate       As Single

    'flatProgressBar1.Value = 0
   ' flatProgressBar1.Visible = True
    
    If chkFit.Value = 0 Then
    
        sRate = CInt(txtRate.text) / 100
        
    End If

    
    If Not rpt.Export2Prn(cmbPageFrom.text, cmbCutPageFrom.text, _
                          cmbPageTo.text, cmbCutPageTo.text, _
                          cmbPrinter.text, sRate, _
                          IIf(chkFit.Value = 1, True, False)) Then
        GoTo err_printer
    End If
        
    
    flatProgressBar1.Visible = False
    
    MsgBox "输出到打印机成功!", vbInformation, Caption
    
    
    Exit Sub
    
    
err_printer:
    MsgBox "输出到打印机错误!", vbExclamation, Caption
    Exit Sub
    
err_other:
    MsgBox "发生不明错误!", vbExclamation, Caption
    Exit Sub
End Sub


Private Sub rpt_PrintProgress(Value As Integer)
   ' flatProgressBar1.Value = Value
End Sub


Private Sub txtRate_GotFocus()
    SelAllTxt txtRate
End Sub


Private Sub txtRate_Validate(Cancel As Boolean)
    fmtTxtData txtRate, 0, 500, 10
End Sub

⌨️ 快捷键说明

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