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

📄 xsfx.frm

📁 电子衡自动计量系统.能对电子汽车衡进行自动计量.完成车皮存储,重车自动除皮等功能.
💻 FRM
📖 第 1 页 / 共 3 页
字号:
    Me.Chart1.Visible = True
    Chart1.ChartData = Values
    Me.Chart1.TitleText = titll
     Clipboard.Clear
    
    Me.Chart1.EditCopy
    
    Me.Picture3.Width = Me.Chart1.Width + 200
    Me.Picture3.Height = Me.Chart1.Height + 100
    Me.Picture3.Picture = Clipboard.GetData()
   
    
End Sub
    
'##################################################################
'## 过程名称:Option1_Click
'## 参数: 无
'##################################################################
Private Sub Option1_Click()
    tjsj = 1
End Sub
    
'##################################################################
'## 过程名称:Option2_Click
'## 参数: 无
'##################################################################
Private Sub Option2_Click()
    tjsj = 2
End Sub
    
'##################################################################
'## 过程名称:Option3_Click
'## 参数: 无
'##################################################################
Private Sub Option3_Click()
    tjsj = 3
End Sub
'##################################################################
'## 过程名称:Form_Resize
'## 参数: 无
'##################################################################
Private Sub Form_Resize()
    On Error Resume Next
    Me.CurtPrinter1.Left = 0
    Me.CurtPrinter1.Width = Me.Width - 200
    Me.CurtPrinter1.Height = Me.Height - 800
    Dim pw, ph, mw, mh, ii, jj As Integer
    Dim x1, y1 As Integer
    pw = Me.Picture3.Width
    ph = Me.Picture3.Height
    mw = Me.Width
    mh = Me.Height
    x1 = Fix(mw / pw)
    y1 = Fix(mh / ph)
    For ii = 1 To x1
        For jj = 1 To y1
            
            Me.PaintPicture Me.Picture3.Picture, (ii - 1) * pw, (jj - 1) * ph, pw, ph
        Next jj
    Next ii
    Me.Picture1.Left = 0
    Me.Picture1.Height = Me.Height - 400
    ' Me.Picture1.Width = Me.Width - 400
    'Me.Picture4.Left = 0
    ' Me.Picture4.Width = Me.Width - 400
    
     CurtPrinter1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight

    Me.Picture2.Left = 0
      Me.Chart1.Left = 0
End Sub
    
    '##################################################################
    '## 过程名称:Form_Unload
    '## 参数:Cancel 为Integer型
    '##################################################################
'##################################################################
'## 过程名称:Form_Unload
'## 参数:Cancel 为Integer型
'##################################################################
Private Sub Form_Unload(Cancel As Integer)
    
    If CurtPrinter1.Busy = True Then '打印预览控件忙则取消打印任务,然后就可以退出了
        CurtPrinter1.CancelPrint
        MsgBox "打印控件忙,稍后重试。", vbInformation
        Cancel = True
    End If
    ' MDIForm1.Toolbar1.Visible = True
End Sub
    
    
    '##################################################################
    '## 过程名称:PrintContent
    '## 参数:Optional 为ntDevice As Printer型
    '##################################################################
'##################################################################
'## 过程名称:PrintContent
'## 参数:Optional 为ntDevice As Printer型
'##################################################################
Public Sub PrintContent(Optional PrintDevice As Printer)
    On Error Resume Next
    Const TableStartX = 10
    Dim jj
    If PrintDevice Is Nothing Then
        CurtPrinter1.StartPrint toPreview '预览
    Else
        CurtPrinter1.StartPrint toPrinter '打印到打印机
    End If
    Dim strr
    With CurtPrinter1
    
    
    '重新开始一页,直接打印报表,注意,它会自动换页,如果你设定了标题,它也自动打哦:)
    .NewPage
    Select Case xianshi
        Case 1
        Me.Chart1.EditCopy
        Me.Picture3.Picture = Clipboard.GetData()
        Me.Chart1.Visible = False
            .Visible = False
            Me.Picture3.Visible = True
             .PictureOut Me.Picture3.Picture, 0, 0
        Case 2
            
            '打印标题,字号为15,居中显示
            .TitleOut Format(titll)
            .CurrentX = TableStartX
            .CellOut "煤种", 60, 8, cellAlignCenterCenter, "2211", vbGrayText
            .CellOut "销售量", 52, 8, cellAlignCenterCenter, "1211", vbGrayText
            .CellOut "百分比", 50, 8, cellAlignCenterCenter, "1211", vbGrayText
            .NewCellRow , TableStartX, 8
            
            For jj = 0 To NumPoints
                .CellOut Format(Values(jj, 1), "######"), 60, 8, cellAlignCenterCenter, "2211"
                .CellOut Format(Str(Values(jj, 2)), "##0.00"), 52, 8, cellAlignCenterCenter, "1211"
                .CellOut FormatPercent(Values(jj, 2) / ljz), 50, 8, cellAlignCenterCenter, "1211"
                .NewCellRow , TableStartX, 8
            Next jj
            
    End Select
    
    '直接打印MSHFlexGrid
    ' .DirectPrint MSHFlexGrid1, Label2.Caption
    'FromDirectPrint MSHFlexGrid1, "FromDirectPrint--MSFlexGrid控件内容,表格起始水平坐标为10", , , 10
    ' strr = Str(Val(Format(Val(Text1.Text) / 1000, "00000000000.000")))
    
    '.TextOut Label3.Caption & Space(10) & DataCombo1.Text
    ' & Space(50) & Label4.Caption & Space(6) & strr & "吨"
    '结束打印
    .EndDoc
    End With
End Sub
    '##################################################################
    '## 过程名称:mnuExit_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuExit_Click
'## 参数: 无
'##################################################################
Private Sub mnuExit_Click()
    Select Case xianshi
        Case 1
            Me.Chart1.Visible = False
        Case 2
            Me.Picture1.Visible = False
    End Select
    
    If Me.CurtPrinter1.Visible = True Then
        Me.CurtPrinter1.Visible = False
    End If
    
    
End Sub
    
    '预览的代码
    '##################################################################
    '## 过程名称:mnuPreview_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuPreview_Click
'## 参数: 无
'##################################################################
Private Sub mnuPreview_Click()
    CurtPrinter1.Visible = True
    mnuManual.Enabled = True
    PrintContent
End Sub
    '两行代码可选,一个会调用打印对话框,一个直接打印了。
    '##################################################################
    '## 过程名称:mnuPrint_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuPrint_Click
'## 参数: 无
'##################################################################
Private Sub mnuPrint_Click()
    'CurtPrinter1.ShowPrinter
    PrintContent Printer
End Sub
    
    '点击了预览控件上的关闭,引发该事件,关闭预览窗体
    '##################################################################
    '## 过程名称:curtprinter1_ClosePreview
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:curtprinter1_ClosePreview
'## 参数: 无
'##################################################################
Private Sub curtprinter1_ClosePreview()
    CurtPrinter1.Visible = False
    mnuManual.Enabled = False
End Sub
    '如果每次调整预览比例好重新生成预览的话,请将AutoRedraw设置为FALSE,然后在下面的事件添入要重画的代码
    '##################################################################
    '## 过程名称:curtprinter1_NeedRedraw
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:curtprinter1_NeedRedraw
'## 参数: 无
'##################################################################
Private Sub CurtPrinter1_NeedRedraw()
    PrintContent
End Sub
    '写入打印叶脚的代码
    '##################################################################
    '## 过程名称:CurtPrinter1_PrintFooter
    '## 参数:CurrentPage 为Long型
    '## 参数:LeftText 为String型
    '## 参数:CenterText 为String型
    '## 参数:RightText 为String型
    '##################################################################
'##################################################################
'## 过程名称:CurtPrinter1_PrintFooter
'## 参数:CurrentPage 为Long型
'## 参数:LeftText 为String型
'## 参数:CenterText 为String型
'## 参数:RightText 为String型
'##################################################################
Private Sub CurtPrinter1_PrintFooter(CurrentPage As Long, LeftText As String, CenterText As String, RightText As String)
    LeftText = jl_zgdw
    CenterText = Format(Now, "yyyy年m月d日")
    RightText = "其他信息"
End Sub
    
    '写入打印页眉的代码
    '##################################################################
    '## 过程名称:CurtPrinter1_PrintHeader
    '## 参数:CurrentPage 为Long型
    '## 参数:LeftText 为String型
    '## 参数:CenterText 为String型
    '## 参数:RightText 为String型
    '##################################################################
'##################################################################
'## 过程名称:CurtPrinter1_PrintHeader
'## 参数:CurrentPage 为Long型
'## 参数:LeftText 为String型
'## 参数:CenterText 为String型
'## 参数:RightText 为String型
'##################################################################
Private Sub CurtPrinter1_PrintHeader(CurrentPage As Long, LeftText As String, CenterText As String, RightText As String)
    LeftText = Date
    CenterText = jl_qym
    RightText = "这是第 " & CurrentPage & " 页"
End Sub
    
    '点击了预览窗体或直接调用ShowPrinter后,点击了打印机窗口的确定,引发打印代码,打印到打印机上!
    '##################################################################
    '## 过程名称:curtprinter1_RealPrint
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:curtprinter1_RealPrint
'## 参数: 无
'##################################################################
Private Sub curtprinter1_RealPrint()
    PrintContent Printer
End Sub
    '如果隐藏工具条,仍可以通过简单的编程控制预览
    '##################################################################
    '## 过程名称:mnuPageDown_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuPageDown_Click
'## 参数: 无
'##################################################################
Private Sub mnuPageDown_Click()
    CurtPrinter1.PageDown
End Sub
    '##################################################################
    '## 过程名称:mnuPageSetup_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuPageSetup_Click
'## 参数: 无
'##################################################################
Private Sub mnuPageSetup_Click()
    CurtPrinter1.PageSetup
End Sub
    '##################################################################
    '## 过程名称:mnuPageUp_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuPageUp_Click
'## 参数: 无
'##################################################################
Private Sub mnuPageUp_Click()
    CurtPrinter1.PageUp
End Sub
    '##################################################################
    '## 过程名称:mnuZoom_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuZoom_Click
'## 参数: 无
'##################################################################
Private Sub mnuZoom_Click()
    CurtPrinter1.Zoom = Val(InputBox("请输入0-200之间的数字")) '0代表整页预览
End Sub
    
    '##################################################################
    '## 过程名称:mnuOrientation_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuOrientation_Click
'## 参数: 无
'##################################################################
Private Sub mnuOrientation_Click()
    CurtPrinter1.Orientation = IIf(CurtPrinter1.Orientation = 1, 2, 1)
End Sub
    
    '##################################################################
    '## 过程名称:mnuPaperSize_Click
    '## 参数: 无
    '##################################################################
'##################################################################
'## 过程名称:mnuPaperSize_Click
'## 参数: 无
'##################################################################
Private Sub mnuPaperSize_Click()
    CurtPrinter1.PaperSize = InputBox("请输入打印纸型号:")
End Sub
    
'##################################################################
'## 过程名称:suoxiao_Click
'## 参数: 无
'##################################################################
Private Sub suoxiao_Click()
    Select Case xianshi
        Case 1
            Me.Chart1.Width = Me.Chart1.Width * 0.8
            Clipboard.Clear
            
            Me.Chart1.EditCopy
            
            Me.Picture3.Width = Me.Chart1.Width + 200
            Me.Picture3.Height = Me.Chart1.Height + 100
            Me.Picture3.Picture = Clipboard.GetData()
        Case 2
            Me.Picture1.Width = Me.Picture1.Width * 0.8
            Me.Picture1.Height = Me.Picture1.Height * 0.8
    End Select
End Sub
    
'##################################################################
'## 过程名称:VScroll1_Change
'## 参数: 无
'##################################################################
Private Sub VScroll1_Change()
    Me.Picture4.Top = -Me.VScroll1.Value
End Sub
    
'##################################################################
'## 过程名称:VScroll1_Scroll
'## 参数: 无
'##################################################################
Private Sub VScroll1_Scroll()
    Me.Picture4.Top = -Me.VScroll1.Value
End Sub

⌨️ 快捷键说明

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