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

📄 打印功能.frm

📁 财务信息管理系统,适合做毕业论文的人使用
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      EndProperty
   End
   Begin prjTBCtrl.CTBCtrl ocxCtbTool 
      Height          =   855
      Left            =   0
      Top             =   0
      Width           =   3975
      _ExtentX        =   7011
      _ExtentY        =   1508
   End
   Begin VB.Menu Menu 
      Caption         =   "比例"
      Visible         =   0   'False
      Begin VB.Menu Mnu 
         Caption         =   "50%"
         Index           =   1
      End
      Begin VB.Menu Mnu 
         Caption         =   "75%"
         Index           =   2
      End
      Begin VB.Menu Mnu 
         Caption         =   "100%"
         Checked         =   -1  'True
         Index           =   3
      End
      Begin VB.Menu Mnu 
         Caption         =   "150%"
         Index           =   4
      End
      Begin VB.Menu Mnu 
         Caption         =   "200%"
         Index           =   5
      End
      Begin VB.Menu Mnu 
         Caption         =   "300%"
         Index           =   6
      End
      Begin VB.Menu Mnu 
         Caption         =   "400%"
         Index           =   7
      End
   End
End
Attribute VB_Name = "frmPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Ratio(7) As Integer
Private MnuIndex As Integer
Private m_EO     As New U8FDEso.EntityObject

Public Property Get EO() As U8FDEso.EntityObject
    Set EO = m_EO
End Property

Public Property Set EO(NewEO As U8FDEso.EntityObject)
    Set m_EO = NewEO
End Property

Private Sub F1BookShow()
    Dim i As Integer, j As Integer, PointNum As String
    On Error Resume Next
    For i = 1 To EO.Fields.count
        If EO.Fields.Item(i).InputCol <> 0 Then
            If Not IsEmpty(EO.Fields.Item(i).Value) And Not IsNull(EO.Fields.Item(i).Value) Then
                PointNum = ""
                If EO.Fields.Item(i).DataType = U8FDEso.DataTypeEnum.esoCurrency Then
                    If EO.Fields.Item(i).Decimals > 0 Then
                        For j = 1 To EO.Fields.Item(i).Decimals
                            PointNum = PointNum & "0"
                        Next
                    End If
                    Me.objF1Book.TextRC(EO.Fields.Item(i).Row, EO.Fields.Item(i).StartCol + 1) = Format(EO.Fields.Item(i).Value, "##,##0" & IIf(Len(Trim(PointNum)) = 0, "", "." & PointNum))
                ElseIf EO.Fields.Item(i).DataType = U8FDEso.DataTypeEnum.esoDouble Then
                    If EO.Fields.Item(i).Decimals > 0 Then
                        For j = 1 To EO.Fields.Item(i).Decimals
                            PointNum = PointNum & "0"
                        Next
                    End If
                    Me.objF1Book.TextRC(EO.Fields.Item(i).Row, EO.Fields.Item(i).StartCol + 1) = Format(EO.Fields.Item(i).Value, "####0" & IIf(Len(Trim(PointNum)) = 0, "", "." & PointNum))
                Else
                    Me.objF1Book.TextRC(EO.Fields.Item(i).Row, EO.Fields.Item(i).StartCol + 1) = EO.Fields.Item(i).Value
                End If
            Else
                Me.objF1Book.TextRC(EO.Fields.Item(i).Row, EO.Fields.Item(i).StartCol + 1) = ""
            End If
        End If
    Next
End Sub

Private Sub Form_Load()
    Dim F1File As New clsF1File
    On Error Resume Next
    
    MSImageList_Initialize ilsTlb
    MSToolBar_Initialize tlbAction, "Print", TB_PRINT
    MSToolBar_Initialize tlbAction, "Ratio", TB_Ratio
    MSToolBar_Initialize tlbAction, "Help", TB_HELP
    MSToolBar_Initialize tlbAction, "Exit", TB_EXIT
    SetTlbStyle Me, False
    ocxCtbTool.RefreshEnable
    '显示比例
    Ratio(1) = 50
    Ratio(2) = 75
    Ratio(3) = 100
    Ratio(4) = 150
    Ratio(5) = 200
    Ratio(6) = 300
    Ratio(7) = 400
    
    MnuIndex = 3
    
    picContainer.left = 0
    picContainer.top = Me.tlbAction.Height
    picContainer.width = Me.ScaleWidth
    picContainer.Height = Me.ScaleHeight - Me.tlbAction.Height
    
    objF1Book.left = 0
    objF1Book.top = 0
    objF1Book.width = Me.ScaleWidth
    objF1Book.Height = Me.ScaleHeight - Me.tlbAction.Height
    
    Me.Menu.Visible = False
    
    g_sF1FileName = GetTmpPath & g_conF1FileName
    F1File.F1Export g_sDataSourceName, g_sF1FileName
    Me.objF1Book.ReadEx g_sF1FileName
    objF1Book.Sheet = frmVchInput.objF1Book.Sheet
    
    F1BookShow
    
    'objF1Book.PrintArea = (frmVchInput.objF1Book.MinCol) & (frmVchInput.objF1Book.MinRow) & ":" & (frmVchInput.objF1Book.MaxCol) & (frmVchInput.objF1Book.MaxRow)
    objF1Book.SetSelection frmVchInput.objF1Book.MinRow, frmVchInput.objF1Book.MinCol, frmVchInput.objF1Book.MaxRow, frmVchInput.objF1Book.MaxCol
    objF1Book.SetPrintAreaFromSelection
    
    objF1Book.PrintColHeading = False
    objF1Book.PrintFooter = "" '"第 &P 页"
    objF1Book.PrintGridLines = False
    objF1Book.PrintHCenter = True
    objF1Book.PrintHeader = ""
    objF1Book.PrintLeftToRight = False
    objF1Book.PrintRowHeading = False
    objF1Book.PrintScale = Ratio(MnuIndex)
    'objF1Book.PrintScaleFitHPages
    objF1Book.PrintScaleFitToPage = False
    'objF1Book.PrintScaleFitVPages
    objF1Book.PrintTitles = ""
    objF1Book.PrintVCenter = False
    objF1Book.Visible = False
    objF1Book.PrintPreviewEx Me.picContainer.hWnd, (ScaleX(objF1Book.width, vbTwips, vbPixels) - ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, (ScaleY(objF1Book.Height, vbTwips, vbPixels) - ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, 1
End Sub

Private Sub Form_Resize()
    On Error Resume Next
    If Me.WindowState <> 1 Then
        picContainer.width = Me.ScaleWidth
        picContainer.Height = Me.ScaleHeight - Me.tlbAction.Height
        objF1Book.width = Me.ScaleWidth
        objF1Book.Height = Me.ScaleHeight - Me.tlbAction.Height
        objF1Book.PrintPreviewEx Me.picContainer.hWnd, (ScaleX(objF1Book.width, vbTwips, vbPixels) - ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, (ScaleY(objF1Book.Height, vbTwips, vbPixels) - ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, 1
        ResizeCtbTool Me, picContainer
    End If
End Sub

Private Sub Mnu_Click(Index As Integer)
    On Error Resume Next
    Mnu(MnuIndex).Checked = False
    Mnu(Index).Checked = True
    MnuIndex = Index
    objF1Book.PrintScale = Ratio(MnuIndex)
    Me.picContainer.Refresh
    objF1Book.PrintPreviewEx Me.picContainer.hWnd, (ScaleX(objF1Book.width, vbTwips, vbPixels) - ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, (ScaleY(objF1Book.Height, vbTwips, vbPixels) - ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, 1
End Sub

Private Sub ocxCtbTool_OnCommand(ByVal enumType As prjTBCtrl.ENUM_MENU_OR_BUTTON, ByVal cButtonId As String, ByVal cMenuId As String)
    tlbAction_ButtonClick tlbAction.Buttons(cButtonId)
End Sub

Private Sub picContainer_Click()
    On Error Resume Next
    Mnu(MnuIndex).Checked = False
    MnuIndex = MnuIndex + 1
    If MnuIndex > 7 Then MnuIndex = 1
    Mnu(MnuIndex).Checked = True
    objF1Book.PrintScale = Ratio(MnuIndex)
    Me.picContainer.Refresh
    objF1Book.PrintPreviewEx Me.picContainer.hWnd, (ScaleX(objF1Book.width, vbTwips, vbPixels) - ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, (ScaleY(objF1Book.Height, vbTwips, vbPixels) - ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, 1
End Sub

Private Sub picContainer_Paint()
    On Error GoTo errOutput
    objF1Book.PrintPreviewEx Me.picContainer.hWnd, (ScaleX(objF1Book.width, vbTwips, vbPixels) - ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, (ScaleY(objF1Book.Height, vbTwips, vbPixels) - ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100) / 2, ScaleX(objF1Book.width, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, ScaleY(objF1Book.Height, vbTwips, vbPixels) * Ratio(MnuIndex) / 100, 1
errOutput:
    Resume Next
End Sub

Private Sub tlbAction_ButtonClick(ByVal Button As MsComctlLib.Button)
    frmMain.cdLog.CancelError = True
    
    On Error GoTo ErrHandler
    If Button.Caption = "比例" Then
        Me.PopupMenu Me.Menu
    ElseIf Button.Caption = "打印" Then
        frmMain.cdLog.Flags = cdlPDAllPages
        frmMain.cdLog.CancelError = True
        frmMain.cdLog.ShowPrinter
        objF1Book.FilePrintEx False, False
    ElseIf Button.key = "Help" Then
        SendKeys "{F1 3}"
    ElseIf Button.Caption = "退出" Then
        Unload Me
    End If
    If UCase(Button.key) <> "EXIT" Then SetTlbStyle Me, False: ocxCtbTool.RefreshEnable
ErrHandler:
    Exit Sub
End Sub

⌨️ 快捷键说明

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