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

📄 printing.frm

📁 Delphi Component - Chart Fx
💻 FRM
字号:
VERSION 5.00
Object = "{8996B0A4-D7BE-101B-8650-00AA003A5593}#4.0#0"; "CFX4032.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "Chart FX. Printing"
   ClientHeight    =   5760
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8910
   LinkTopic       =   "Form1"
   ScaleHeight     =   5760
   ScaleWidth      =   8910
   StartUpPosition =   3  'Windows Default
   Begin ChartfxLibCtl.ChartFX ChartFX1 
      Height          =   5775
      Left            =   120
      TabIndex        =   6
      Top             =   0
      Width           =   6855
      _cx             =   2011049787
      _cy             =   2011047882
      _Version        =   262144
      TypeMask        =   42468358
      Style           =   -1
      Stacked         =   1
      Axis(0).Max     =   190
      nPts            =   30
      NumPoint        =   30
      _Data_          =   "printing.frx":0000
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Page setup ..."
      Height          =   375
      Left            =   7200
      TabIndex        =   5
      Top             =   1320
      Width           =   1335
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   8280
      Top             =   5160
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      PrinterDefault  =   0   'False
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Print per page ..."
      Height          =   375
      Left            =   7080
      TabIndex        =   4
      Top             =   2400
      Width           =   1695
   End
   Begin VB.OptionButton Option3 
      Caption         =   "Prompt user"
      Height          =   255
      Left            =   7200
      TabIndex        =   3
      Top             =   960
      Width           =   1455
   End
   Begin VB.OptionButton Option2 
      Caption         =   "Landscape"
      Height          =   255
      Left            =   7200
      TabIndex        =   2
      Top             =   720
      Width           =   1455
   End
   Begin VB.OptionButton Option1 
      Caption         =   "Porttrait"
      Height          =   255
      Left            =   7200
      TabIndex        =   1
      Top             =   480
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Print ALL"
      Height          =   375
      Left            =   7080
      TabIndex        =   0
      Top             =   1920
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Caption         =   "Page layout"
      Height          =   1695
      Left            =   7080
      TabIndex        =   7
      Top             =   120
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Check1_Click()
End Sub
' Print all chart at once
Private Sub Command1_Click()
    If Option3 Then  ' prompt user
        CommonDialog1.ShowPrinter
        If CommonDialog1.hDC Then
            ChartFX1.Printer.hDC = CommonDialog1.hDC
        Else
            Exit Sub
        End If
    End If
    
    ChartFX1.PrintIt 0, 0   ' Print
    ChartFX1.Printer.hDC = 0 ' Restore
End Sub

' Print each page individually
Private Sub Command2_Click()
    Dim lLastPoint As Long
    Dim nPage As Integer
    Dim bQuit As Boolean
    Dim nTotPoints As Long
    Dim nTotPages As Integer
    
    If Option3 Then
        CommonDialog1.ShowPrinter
        If CommonDialog1.hDC Then
            ChartFX1.Printer.hDC = CommonDialog1.hDC
        Else
            Exit Sub
        End If
    End If
    
    ' Print one page ata a time
    bQuit = False
    nPage = 1
    nTotPoints = ChartFX1.NValues
    nTotPages = -1
    While Not bQuit
        lLastPoint = ChartFX1.PrintIt(nPage, nPage) ' Print one page
        
        If lLastPoint And (lLastPoint < nTotPoints) Then ' Is there more ?
            If nTotPages < 0 Then
                nTotPages = ((nTotPoints / lLastPoint) + 0.5) ' Calculate total
            End If
            If MsgBox("Page " & Str(nPage) & " of " & Str(nTotPages) & " Done." & Chr$(10) & "Another Page ?", vbYesNo) <> vbYes Then
                bQuit = True
            End If
            nPage = nPage + 1 ' Next page
        Else
            bQuit = True
        End If
    Wend
    
    ChartFX1.Printer.hDC = 0 'Restore
    
End Sub

Private Sub Command3_Click()
    ChartFX1.ShowDialog CDIALOG_PAGESETUP, 0
End Sub


Private Sub Form_Load()
    ChartFX1.RecalcScale
    CommonDialog1.Flags = cdlPDReturnDC Or cdlPDPrintSetup
End Sub

Private Sub Option1_Click()
    ChartFX1.Printer.Orientation = ORIENTATION_PORTRAIT
    ChartFX1.ToolBarObj(0).CommandID = CFX_ID_PRINT
End Sub

Private Sub Option2_Click()
    ChartFX1.Printer.Orientation = ORIENTATION_LANDSCAPE
    ChartFX1.ToolBarObj(0).CommandID = CFX_ID_PRINT
End Sub

Private Sub Option3_Click()
    ChartFX1.Printer.Orientation = ORIENTATION_DEFAULT
    ChartFX1.ToolBarObj(0).CommandID = CFX_ID_DLGPRINT ' Show printer setup dialog before printer
End Sub

⌨️ 快捷键说明

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