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

📄 printdlg.frm

📁 收集的100多个适合不同层次VB爱好者编程的实例源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "完全控制打印"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3855
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   3855
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text3 
      Height          =   270
      Left            =   1680
      TabIndex        =   3
      Text            =   "Text3"
      Top             =   1440
      Width           =   735
   End
   Begin VB.TextBox Text2 
      Height          =   270
      Left            =   1680
      TabIndex        =   2
      Text            =   "Text2"
      Top             =   840
      Width           =   735
   End
   Begin VB.TextBox Text1 
      Height          =   270
      Left            =   1680
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   240
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "打印"
      Height          =   495
      Left            =   1080
      TabIndex        =   0
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "份数:"
      Height          =   255
      Left            =   960
      TabIndex        =   6
      Top             =   1440
      Width           =   735
   End
   Begin VB.Label Label2 
      Caption         =   "结束页:"
      Height          =   375
      Left            =   960
      TabIndex        =   5
      Top             =   840
      Width           =   735
   End
   Begin VB.Label Label1 
      Caption         =   "开始页:"
      Height          =   255
      Left            =   960
      TabIndex        =   4
      Top             =   360
      Width           =   735
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function PRINTDLG Lib "comdlg32.dll" Alias "PrintDlgA" _
    (pPrintdlg As PRINTDLG _
    ) As Long
'类型声明
Private Type PRINTDLG
    lStructSize As Long
    hwndOwner As Long
    hDevMode As Long
    hDevNames As Long
    hdc As Long
    flags As Long
    nFromPage As Integer
    nToPage As Integer
    nMinPage As Integer
    nMaxPage As Integer
    nCopies As Integer
    hInstance As Long
    lCustData As Long
    lpfnPrintHook As Long
    lpfnSetupHook As Long
    lpPrintTemplateName As String
    lpSetupTemplateName As String
    hPrintTemplate As Long
    hSetupTemplate As Long
End Type

Private Sub Command1_Click()
    Dim p As PRINTDLG
    p.lStructSize = Len(p)
    p.hwndOwner = Me.hWnd
    p.nFromPage = Text1.Text
    p.nToPage = Text2.Text
    p.nMinPage = 1
    p.nMaxPage = 1
    p.nCopies = Text3.Text
    x = PRINTDLG(p)
 
End Sub

⌨️ 快捷键说明

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