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

📄 frmquerylog.frm

📁 水电费收费管理系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
                            .Col = 10
                            Printer.CurrentX = 147
                            Printer.CurrentY = 33 + CY
                            Printer.Print .Text
                            
                            .Col = 11
                            Printer.CurrentX = 156
                            Printer.CurrentY = 33 + CY
                            Printer.Print .Text
                
                            
                            .Col = 12
                            Printer.CurrentX = 166
                            Printer.CurrentY = 33 + CY
                            Printer.Print .Text
                            
                            .Col = 13
                            Printer.CurrentX = 180
                            Printer.CurrentY = 33 + CY
                            Printer.Print .Text
                           
                           Printer.DrawStyle = 2
                           Printer.Line (0, 42 + CY)-(200, 42 + CY), 0, B
                           
                        Next
                        Printer.NewPage
                        If .Row = .Rows - 1 Then Exit For
                    Next
                    'Next
                    '打印到文件结尾
                    Printer.EndDoc
                Else
                
                     Dim dh  As Long, DS As String
                    '打印标题
            
                    Printer.FontSize = 15
                    Printer.CurrentX = (Print_W - TextWidth(Trim(Me.lblTitle.Caption)) / 56.7) / 2 - 30
                    Printer.CurrentY = 20
                    dh = 20 + TextHeight(lblTitle.Caption) / 56.7 + 5
                    Printer.Print lblTitle.Caption
                    Printer.FontSize = 10
                    
                    '打印当前日期
                    DS = "制表日期:" & STR(Year(Now)) & "年" & STR(Month(Now)) & "月" & STR(Day(Now)) & "日"
                    Printer.CurrentX = Print_W - TextWidth(DS) / 56.7 - 40
                    Printer.CurrentY = dh
                    Printer.Print DS
                    dh = dh + TextHeight(DS) / 56.7 + 8
                    '调用打印表格的子程序,打印表格内容
                    Printer.DrawStyle = 0
                    Print_Grid mfgFee, dh
                
                    '打印到文件结尾
                    Printer.EndDoc
            
                End If
            End With
        Case 2  '退出
            Unload Me
        Case 3  '预览
            Picture1.Cls
            Picture1.Visible = True
            Picture2.Visible = True
            HScroll1.Visible = True
            VScroll1.Visible = True
'            Picture2.ZOrder 0
'            Picture1.ZOrder 0
            Picture1.ScaleMode = vbMillimeters
            Picture1.Height = 297 * 56.7
            Picture1.Width = 210 * 56.7
            CY = 30
            With mfgFee
                For u = 1 To Int((.Rows - 1) / 12 + (1 - 1 / 12))
                    For i = 1 To 12
                        .Row = (u - 1) * 12 + i
                        CX = 110 * ((.Row - 1) Mod 2)
                        CY = Int((i - 1) / 2) * 46
                        .Col = 0
                        Picture1.CurrentX = 23 + CX
                        Picture1.CurrentY = 15 + CY
                        Picture1.Print .Text
                        
                        .Col = 1
                        Picture1.CurrentX = 53 + CX
                        Picture1.CurrentY = 15 + CY
                        Picture1.Print .Text
                        
                        Picture1.CurrentX = 65 + CX
                        Picture1.CurrentY = 15 + CY
                        Picture1.Print Year(Now) & "   " & Month(Now)
                        
                        .Col = 2
                        Picture1.CurrentX = 16 + CX
                        Picture1.CurrentY = 26 + CY
                        Picture1.Print .Text
                        
                        .Col = 3
                        Picture1.CurrentX = 32 + CX
                        Picture1.CurrentY = 26 + CY
                        Picture1.Print .Text
                        
                        .Col = 4
                        Picture1.CurrentX = 47 + CX
                        Picture1.CurrentY = 26 + CY
                        Picture1.Print .Text
                        
                        .Col = 5
                        Picture1.CurrentX = 59 + CX
                        Picture1.CurrentY = 26 + CY
                        Picture1.Print .Text
                        
                        .Col = 6
                        Picture1.CurrentX = 75 + CX
                        Picture1.CurrentY = 26 + CY
                        Picture1.Print .Text
                        
                        .Col = 7
                        Picture1.CurrentX = 90 + CX
                        Picture1.CurrentY = 26 + CY
                        Picture1.Print .Text
                        
                        .Col = 8
                        Picture1.CurrentX = 102 + CX
                        Picture1.CurrentY = 26 + CY
                        Picture1.Print .Text
                        
                        sTotalFee = .Text * 100
                        For j = 1 To Len(Trim(sTotalFee))
                            Picture1.CurrentX = 30 + CX + 10 * (7 - Len(Trim(sTotalFee)) + j)
                            Picture1.CurrentY = 34 + CY
                            Picture1.Print sLowerToUpper(Mid(sTotalFee, j, 1))
                        Next
                        
                        If .Row = .Rows - 1 Then Exit For
                    Next
                    Exit For
                    'Picture1.NewPage
                Next
        End With
    End Select
    Exit Sub
ErrHandler:
    If Err.Number = 32755 Then Exit Sub
End Sub

Private Sub Form_Load()

    Fillcomb cmbElement, "select * from louhao order by bmid", "bmname"
    
    cmbRTU.ListIndex = 0
    
    
    lblTitle.Caption = ""
    dtpStart = DateSerial(Year(Date), Month(Date), 1)
    mfgFee.Clear
    'AddCombo1 cboPrecinct, "select * from bmPowerElement where type='所'"
    Picture1.Visible = False
    Picture2.Visible = False
    HScroll1.Visible = False
    VScroll1.Visible = False
End Sub

Private Sub Form_Resize()
    On Error Resume Next
    With mfgFee
        .Top = 1800
        .Left = 60
        .Height = Me.Height - 2800
        .Width = Me.Width - 260
        lblTitle.Left = .Left
        lblTitle.Width = .Width
        Picture2.Left = .Left
        Picture2.Width = .Width - 280
        Picture2.Height = .Height - 280
        Picture2.Top = .Top
        Picture1.Left = 0
        Picture1.Width = 210 * 56.7
        Picture1.Height = 297 * 56.7
        Picture1.Top = 0
        VScroll1.Top = .Top
        VScroll1.Width = 280
        VScroll1.Height = .Height
        VScroll1.Left = 60 + .Width - 280
        HScroll1.Left = .Left
        HScroll1.Width = .Width - 280
        HScroll1.Height = 280
        HScroll1.Top = 1200 + .Height - 280
    End With
    command1(0).Top = 1900 + mfgFee.Height
    command1(1).Top = command1(0).Top
    command1(2).Top = command1(0).Top
    command1(3).Top = command1(0).Top
End Sub


Private Sub HScroll1_Scroll()
    'If bFlag = False Then Exit Sub
    If Picture1.Left <= (Me.Width - Picture2.Width) / 2 Then
        Picture1.Left = -(HScroll1 / 100) * (Me.Width - Picture2.Width) / 2 - 400
    Else
        Picture1.Left = (Me.Width - Picture2.Width) / 2
    End If
End Sub

Private Sub VScroll1_Change()
    'If bFlag = False Then Exit Sub
    If Picture1.Top <= Me.Height - Picture2.Height Then
        Picture1.Top = -(VScroll1 / 100) * Me.Height + 400
    Else
        Picture1.Top = Me.Height - Picture2.Height
    End If
End Sub

Private Sub hScroll1_Change()
    'If bFlag = False Then Exit Sub
    If Picture1.Left <= (Me.Width - Picture2.Width) / 2 Then
        Picture1.Left = -(HScroll1 / 100) * (Me.Width - Picture2.Width) / 2 - 400
    Else
        Picture1.Left = (Me.Width - Picture2.Width) / 2
    End If
End Sub

Private Sub VScroll1_Scroll()
    'If bFlag = False Then Exit Sub
    If Picture1.Top <= Me.Height - Picture2.Height Then
        Picture1.Top = -(VScroll1 / 100) * Me.Height + 600
    Else
        Picture1.Top = Me.Height - Picture2.Height
    End If
End Sub

'打印Grid对象的子程序,只要给出表格的名称和起始的X,Y坐标,即可完成操作
Sub Print_Grid(gd As Control, CY0 As Long)
    On Error Resume Next
    Dim i As Integer, j As Integer
    Dim CX0 As Single
    
    'Printer.ScaleMode = 3
    Printer.FontSize = 10
    With gd
        For i = 0 To .Rows - 1
            .Row = i
            CX0 = 22
            For j = 0 To .Cols - 3
                .Col = j
                '打印表格线
                Printer.Line (CX0, CY0)-(CX0 + .ColWidth(j) / 56.7 + 3, _
                        CY0 + TextHeight("d") / 56.7 * 2), 0, B
                '设置表格内文字的位置
                If .Row = 0 Then
                    Printer.CurrentX = CX0 + (.ColWidth(j) / 56.7 - TextWidth(.Text) / 56.7) / 2 + 1.5
                ElseIf .ColAlignment(j) = 7 Then
                    Printer.CurrentX = CX0 + (.ColWidth(j) / 56.7 + 3 - TextWidth(.Text) / 56.7) - 3
                Else
                    Printer.CurrentX = CX0 + 1.5
                End If
                Printer.CurrentY = CY0 + 1.5
                '打印文字
                Printer.Print .Text
                '计算下一列表格的起始横坐标位置
                CX0 = CX0 + .ColWidth(j) / 56.7 + 3
            Next j
            '计算下一行表格的起始纵坐标位置
            If CY0 >= Print_H - 30 Then
                Printer.NewPage
                CY0 = 30
            Else
                CY0 = CY0 + TextHeight("d") / 56.7 * 2
            End If
        Next i
    End With
End Sub

Function fPrintText(sTitle As String, CX As Single, CY As Single, _
                iFontSize As Integer, bBold As Boolean)
    P.Font.Bold = bBold
    P.FontSize = iFontSize
    P.CurrentX = CX
    P.CurrentY = CY
    P.Print sTitle
End Function

Function sGetElementName(iPrecinct As Integer) As String
    Dim MySet2 As Recordset
    MySQL = "select * from bmPowerElement where elementid=" & iPrecinct
    Set MySet2 = Mydb.OpenRecordset(MySQL, 2)
    sGetElementName = MySet2("ElementName")
End Function


⌨️ 快捷键说明

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