📄 thsqpreveiw.frm
字号:
EndProperty
End
End
Attribute VB_Name = "THSQPREVIEW"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Xx, Yy, Xx1, Yy1
Dim cx, cy
Dim Sr
Dim p As New PrnCls
Dim START As Long, STRPRINT As String, BZTOP As Long, STRFH As String
Dim X
Dim psm
Dim zm
Dim HC, YHC ' 页记录数
Dim PS, ZPS ' 总页数
Private Sub Combo1_Validate(Cancel As Boolean)
Toolbar1_ButtonClick Toolbar1.Buttons(2)
End Sub
Private Sub Form_Activate()
Data1.Refresh
If Data1.Recordset.RecordCount > 0 Then Data1.Recordset.MoveLast
YHC = 30 '设置页记录数
PS = 1 '设置起始页1
ZPS = Round(Data1.Recordset.RecordCount / YHC + 0.5, 0) '设置总页数
Text1.Text = 1
UpDown1.Min = 1
UpDown1.Max = ZPS
' Toolbar1_ButtonClick Toolbar1.Buttons(2)
End Sub
Private Sub Form_Load()
Combo1.AddItem ("0.25")
Combo1.AddItem ("0.5")
Combo1.AddItem ("1")
Combo1.AddItem ("2")
Combo1.AddItem ("3")
Data1.DatabaseName = App.Path & "\DATA\JDGL.MDB"
Data1.Refresh
End Sub
Private Sub Form_Resize()
With preview1
.Width = IIf(ScaleWidth - (.left) * 2 > 0, ScaleWidth - (.left) * 2, 0)
.Height = IIf(ScaleHeight - .top > 0, ScaleHeight - .top, 0)
preview1.Refresh
End With
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Dim BZJHJ, INTFROMPAGE, INTTOPAGE, INTPAGE
On Error GoTo EXITERROR
If Button = "打印" Then
CommonDialog1.FromPage = UpDown1.Min
CommonDialog1.ToPage = UpDown1.Max
CommonDialog1.Min = UpDown1.Min
CommonDialog1.Max = UpDown1.Max
CommonDialog1.ShowPrinter
If CommonDialog1.flags Mod 16 = 0 Then
INTFROMPAGE = 1
INTTOPAGE = UpDown1.Max
End If
If (CommonDialog1.flags - 1) Mod 16 = 0 Then
INTFROMPAGE = 1
INTTOPAGE = UpDown1.Max
End If
If (CommonDialog1.flags - 2) Mod 16 = 0 Then
INTFROMPAGE = CommonDialog1.FromPage
INTTOPAGE = CommonDialog1.ToPage
End If
For INTPAGE = INTFROMPAGE To INTTOPAGE '起始页码
Text1.Text = INTPAGE
Toolbar1_ButtonClick Toolbar1.Buttons(4)
Next
End If
If Button = "退出" Then
Unload Me
Exit Sub
End If
zm = Val(Combo1.Text)
Sr = 1440
If Button = "输出" Then
p.PrintStartDoc Printer, zm
Else
p.PrintStartDoc preview1, zm
End If
PS = Text1.Text
If Data1.Recordset.RecordCount > 0 Then Data1.Recordset.MoveFirst
For HC = 1 To YHC * (PS - 1)
Data1.Recordset.MoveNext
Next
p.ForeColor = &H0&
p.ForeColor = &HFF0000
p.CurrentY = 1.2 * Sr
p.CurrentX = 1.6 * Sr
p.FontName = "宋体"
p.FontItalic = True
p.FontSize = 12
p.PrintPrint STRBGNAME
p.CurrentX = 2.3 * Sr
p.CurrentY = p.CurrentY - 240.485 / 2
p.FontSize = 18
p.FontItalic = False
p.PrintPrint "团会赊欠一览表"
p.FontSize = 11
p.NewLine
p.NewLine
p.CurrentX = 2.2 * Sr
p.PrintPrint " 日期:" & Format(Now, "LONG DATE")
p.NewLineBG 0
p.CurrentY = p.CurrentY + 80
p.CurrentX = 200
p.FontBold = True
p.BoxOut "编号", 1600, "C", 200, "1111"
p.BoxOut "团会名称", 3000, "C", 200, "1111"
p.BoxOut "赊欠金额", 1800, "C", 200, "1111"
p.BoxOut "附 注", 2000, "C", 200, "1111"
p.FontBold = False
p.CurrentY = p.CurrentY + 100
BZJHJ = 0
For HC = 1 To YHC
p.NewLineBG 0
p.CurrentX = 200
p.CurrentY = p.CurrentY + 100
If Not Data1.Recordset.EOF Then
p.BoxOut IIf(Not IsNull(Data1.Recordset("团会ID")), Data1.Recordset("团会ID"), ""), 1600, "C", 100, "1111"
p.BoxOut IIf(Not IsNull(Data1.Recordset("团会名称")), Data1.Recordset("团会名称"), ""), 3000, "L", 100, "1111"
p.BoxOut IIf(Not IsNull(Data1.Recordset("赊欠金额")), FormatNumber(Data1.Recordset("赊欠金额"), 2, vbTrue, , vbFalse), ""), 1800, "R", 100, "1111"
If Not IsNull(Data1.Recordset("赊欠金额")) Then
BZJHJ = BZJHJ + Data1.Recordset("赊欠金额")
End If
p.BoxOut "", 2000, "C", 100, "1111"
Data1.Recordset.MoveNext
Else
p.BoxOut "", 1600, "C", 100, "1111"
p.BoxOut "", 3000, "C", 100, "1111"
p.BoxOut "", 1800, "C", 100, "1111"
p.BoxOut "", 2000, "C", 100, "1111"
End If
Next
p.NewLineBG 0
p.CurrentX = 200
p.CurrentY = p.CurrentY + 100
If Data1.Recordset.EOF Then
p.BoxOut "总 合 计", 4610, "C", 100, "1111"
BZJHJ = 0
If Data1.Recordset.RecordCount > 0 Then Data1.Recordset.MoveFirst
While Not Data1.Recordset.EOF
BZJHJ = BZJHJ + IIf(Data1.Recordset("赊欠金额") <> 0, Data1.Recordset("赊欠金额"), 0)
Data1.Recordset.MoveNext
Wend
p.BoxOut IIf(BZJHJ <> 0, FormatNumber(BZJHJ, 2, vbTrue, , vbFalse), ""), 1800, "R", 100, "1111"
Else
p.BoxOut "本 页 合 计", 4610, "C", 100, "1111"
p.BoxOut IIf(BZJHJ <> 0, FormatNumber(BZJHJ, 2, vbTrue, , vbFalse), ""), 1800, "R", 100, "1111"
End If
p.BoxOut "", 2000, "C", 100, "1111"
p.NewLineBG 0
p.CurrentX = 200
p.CurrentY = p.CurrentY + 100
p.CurrentX = 400
p.CurrentY = p.CurrentY + 100
p.PrintPrint "负责人: 制表:" & frmLogin.CZYXM & Space(8 - LenB(frmLogin.CZYXM)) & " 总" & CStr(ZPS) & "页第" & CStr(PS) & "页"
p.NewLine
p.NewLine
p.NewLine
p.EndDoc
Exit Sub
EXITERROR:
If Err.Number = 32755 Then
Exit Sub
Else
MsgBox CStr(Err.Number) & "-" & Err.Description, vbCritical, "错误信息"
Exit Sub
End If
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
If ButtonMenu = "25%" Then
Combo1.Text = "0.25"
Else
If ButtonMenu = "50%" Then
Combo1.Text = "0.5"
Else
If ButtonMenu = "100%" Then
Combo1.Text = "1"
Else
If ButtonMenu = "200%" Then
Combo1.Text = "2"
Else
If ButtonMenu = "300%" Then
Combo1.Text = "3"
End If
End If
End If
End If
End If
Toolbar1_ButtonClick Toolbar1.Buttons(2)
End Sub
Public Sub PR()
Toolbar1_ButtonClick Toolbar1.Buttons(2)
End Sub
Private Sub UpDown1_Change()
Toolbar1_ButtonClick Toolbar1.Buttons(2)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -