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

📄 frmprint.frm

📁 最完美的托盘功能及气泡提示控件最完美的托盘功能及气泡提示控件最完美的托盘功能及气泡提示控件最完美的托盘功能及气泡提示控件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmPrint 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "源代码打印输出"
   ClientHeight    =   5430
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4845
   Icon            =   "frmPrint.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5430
   ScaleWidth      =   4845
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text 
      Height          =   285
      Index           =   3
      Left            =   2640
      TabIndex        =   7
      Text            =   "Text"
      ToolTipText     =   "Margin in cm."
      Top             =   4320
      Width           =   615
   End
   Begin VB.TextBox Text 
      Height          =   285
      Index           =   2
      Left            =   3240
      TabIndex        =   6
      Text            =   "Text"
      ToolTipText     =   "Margin in cm."
      Top             =   3240
      Width           =   615
   End
   Begin VB.TextBox Text 
      Height          =   285
      Index           =   1
      Left            =   600
      TabIndex        =   5
      Text            =   "Text"
      ToolTipText     =   "Margin in cm."
      Top             =   3720
      Width           =   615
   End
   Begin VB.TextBox Text 
      Height          =   285
      Index           =   0
      Left            =   1080
      TabIndex        =   4
      Text            =   "Text"
      ToolTipText     =   "Margin in cm."
      Top             =   2640
      Width           =   615
   End
   Begin VB.ComboBox Combo 
      Height          =   315
      ItemData        =   "frmPrint.frx":000C
      Left            =   1560
      List            =   "frmPrint.frx":0020
      Style           =   2  'Dropdown List
      TabIndex        =   3
      Top             =   2040
      Width           =   2055
   End
   Begin VB.CommandButton CmdOK 
      Caption         =   "确定(&O)"
      Default         =   -1  'True
      Height          =   375
      Left            =   2040
      TabIndex        =   8
      Top             =   4920
      Width           =   1095
   End
   Begin VB.CommandButton CmdCancel 
      Caption         =   "取消(&C)"
      Height          =   375
      Left            =   3360
      TabIndex        =   9
      Top             =   4920
      Width           =   1095
   End
   Begin VB.Frame Frame3 
      Caption         =   "选项"
      Height          =   1095
      Left            =   2400
      TabIndex        =   14
      Top             =   720
      Width           =   2295
      Begin VB.CheckBox Check1 
         Caption         =   "打印索引页"
         Height          =   195
         Left            =   360
         TabIndex        =   2
         Top             =   360
         Width           =   1500
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "打印范围 :"
      Height          =   1095
      Left            =   120
      TabIndex        =   13
      Top             =   720
      Width           =   1935
      Begin VB.OptionButton OptionB 
         Caption         =   "选择"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   0
         Top             =   360
         Width           =   1335
      End
      Begin VB.OptionButton OptionB 
         Caption         =   "当前模块"
         Height          =   255
         Index           =   1
         Left            =   120
         TabIndex        =   1
         Top             =   720
         Value           =   -1  'True
         Width           =   1695
      End
   End
   Begin VB.CommandButton CmdSetup 
      Caption         =   "设置..."
      Height          =   375
      Left            =   3600
      TabIndex        =   10
      Top             =   120
      Width           =   1095
   End
   Begin VB.Label Label7 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000004&
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Caption         =   "提示: 页面空白来自打印机打印区域. 不是纸张边框."
      ForeColor       =   &H80000008&
      Height          =   975
      Left            =   3480
      TabIndex        =   20
      ToolTipText     =   "Note: Margins are set from printer print area. Not from paper borders."
      Top             =   3720
      Width           =   1215
   End
   Begin VB.Line Line3 
      BorderColor     =   &H80000005&
      X1              =   120
      X2              =   4680
      Y1              =   1935
      Y2              =   1935
   End
   Begin VB.Line Line4 
      BorderColor     =   &H80000003&
      X1              =   120
      X2              =   4680
      Y1              =   1920
      Y2              =   1920
   End
   Begin VB.Image Image1 
      Height          =   1290
      Left            =   1440
      Picture         =   "frmPrint.frx":003C
      Stretch         =   -1  'True
      Top             =   3000
      Width           =   1020
   End
   Begin VB.Label Label6 
      Caption         =   "底部:"
      Height          =   255
      Left            =   1920
      TabIndex        =   19
      Top             =   4380
      Width           =   615
   End
   Begin VB.Label Label5 
      Caption         =   "右侧 :"
      Height          =   255
      Left            =   2640
      TabIndex        =   18
      Top             =   3255
      Width           =   600
   End
   Begin VB.Label Label4 
      Caption         =   "左侧 :"
      Height          =   255
      Left            =   60
      TabIndex        =   17
      Top             =   3765
      Width           =   630
   End
   Begin VB.Label Label3 
      Caption         =   "顶部:"
      Height          =   255
      Left            =   585
      TabIndex        =   16
      Top             =   2700
      Width           =   615
   End
   Begin VB.Line Line6 
      BorderColor     =   &H80000003&
      X1              =   120
      X2              =   4680
      Y1              =   2520
      Y2              =   2520
   End
   Begin VB.Line Line5 
      BorderColor     =   &H80000005&
      X1              =   120
      X2              =   4680
      Y1              =   2535
      Y2              =   2535
   End
   Begin VB.Label Label2 
      Caption         =   "打印质量 :"
      Height          =   255
      Left            =   240
      TabIndex        =   15
      Top             =   2070
      Width           =   1215
   End
   Begin VB.Line Line2 
      BorderColor     =   &H80000005&
      X1              =   120
      X2              =   4680
      Y1              =   4815
      Y2              =   4815
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000003&
      X1              =   120
      X2              =   4680
      Y1              =   4800
      Y2              =   4800
   End
   Begin VB.Label LblPrinter 
      Caption         =   "Label2"
      Height          =   255
      Left            =   1080
      TabIndex        =   12
      Top             =   240
      Width           =   2415
   End
   Begin VB.Label Label1 
      Caption         =   "打印机 : "
      Height          =   255
      Left            =   240
      TabIndex        =   11
      Top             =   240
      Width           =   735
   End
End
Attribute VB_Name = "frmPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' Module Name:  frmPrint.frm
' Author:       Santiago
' email:        Santiago@InternetDeTelgua.com.gt
' Date:         23-Abr-01
' Description:  The purpose of this form is to bring the user the choice to define printer settings,
'               print an index page, print the entire module or to print only the selected text

Public Sub Display()
    Dim StartLine&, EndLine&, StartCol&, EndCol&
    
    '获取在窗口中选择的行数范围
    VBI.ActiveCodePane.GetSelection StartLine, StartCol, EndLine, EndCol
    
    
    LblPrinter.Caption = Printer.DeviceName
    
    '允许或者禁止范围"选择"按钮
    OptionB(0).Enabled = StartCol <> EndCol Or StartLine <> EndLine
    Me.Show vbModal
    
End Sub

Private Sub CmdCancel_Click()
    Unload Me
End Sub

Private Sub CmdOK_Click()
    Dim PrintCode As New PrintSource

    MousePointer = vbHourglass
    Screen.MousePointer = vbHourglass
    
    '设置打印质量和页面空白
    Printer.PrintQuality = Combo.ItemData(Combo.ListIndex)
    
    PrintCode.PrinterTop = Text(0)
    PrintCode.PrinterLeft = Text(1)
    PrintCode.PrinterRigth = Text(2)
    PrintCode.PrinterBottom = Text(3)
    
    If OptionB(0) Then
        '打印选择模块
        PrintCode.PrintSourceCode True, Check1.Value = vbChecked
    Else
        '打印整个模块
        PrintCode.PrintSourceCode False, Check1.Value = vbChecked
    End If
    MousePointer = vbDefault
    
    '页面空白
    SaveSetting Me.Name, "Settings", "PrintTop", Text(0)
    SaveSetting Me.Name, "Settings", "PrintLeft", Text(1)
    SaveSetting Me.Name, "Settings", "PrintRight", Text(2)
    SaveSetting Me.Name, "Settings", "PrintBottom", Text(3)
    
    '打印质量
    SaveSetting Me.Name, "Settings", "PrintQuality", Combo.ItemData(Combo.ListIndex)
    Screen.MousePointer = vbDefault
    Unload Me
End Sub

Private Sub CmdSetup_Click()
    If ShowPrinter(Me, PD_PRINTSETUP) Then UpdateCombo Printer.PrintQuality
End Sub

Private Sub UpdateCombo(PQuality As Long)
    Dim i%
    
    If PQuality <> Combo.ItemData(Combo.ListIndex) Then
        Select Case Printer.PrintQuality
            Case vbPRPQDraft
                Combo.ListIndex = 0
            Case vbPRPQLow
                Combo.ListIndex = 1
            Case vbPRPQMedium
                Combo.ListIndex = 2
            Case vbPRPQHigh
                Combo.ListIndex = 3
            Case Else
                For i = 0 To Combo.ListCount - 1
                    If Combo.ItemData(i) = PQuality Then
                        Combo.ListIndex = i
                        Exit For
                    End If
                Next
                If i = Combo.ListCount Then
                    Combo.AddItem PQuality
                    Combo.ItemData(Combo.NewIndex) = PQuality
                    Combo.ListIndex = Combo.NewIndex
                End If
        End Select
    End If
End Sub

Private Sub Combo_Click()
    Printer.PrintQuality = Combo.ItemData(Combo.ListIndex)
End Sub

Private Sub Form_Load()
    '记忆上次窗口位置
    With Me
        .Left = GetSetting(Me.Name, "Settings", Me.Name & "MainLeft", .Left)
        .Top = GetSetting(Me.Name, "Settings", Me.Name & "MainTop", .Top)
    End With
    
    '页面空白
    Text(0) = FormatNumber(GetSetting(Me.Name, "Settings", "PrintTop", 0), 2)
    Text(1) = FormatNumber(GetSetting(Me.Name, "Settings", "PrintLeft", 0), 2)
    Text(2) = FormatNumber(GetSetting(Me.Name, "Settings", "PrintRight", 0), 2)
    Text(3) = FormatNumber(GetSetting(Me.Name, "Settings", "PrintBottom", 0), 2)
    
    '打印质量
    Combo.ListIndex = 0
    UpdateCombo FormatNumber(GetSetting(Me.Name, "Settings", "PrintQuality", vbPRPQDraft), 2)
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    
    '保存窗口位置
    With Me
        SaveSetting Me.Name, "Settings", Me.Name & "MainLeft", .Left
        SaveSetting Me.Name, "Settings", Me.Name & "MainTop", .Top
    End With
    
    Set frmPrint = Nothing
End Sub

Private Sub Text_GotFocus(Index As Integer)
    With Text(Index)
        .SelStart = 0
        .SelLength = Len(.Text)
    End With
End Sub

Private Sub Text_LostFocus(Index As Integer)
    With Text(Index)
        .Text = FormatNumber(.Text, 2)
    End With
End Sub

Public Function FormatNumber(Numero As String, Decimales As Integer) As String
    FormatNumber = Format(Numero, "###,###,##0." & String(Decimales, "0"))
End Function

⌨️ 快捷键说明

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