📄 form1.frm
字号:
Private Sub Command4_Click()
Dim RoomNumber As String
Dim Title1 As String
Dim Title2 As String
Dim TechName As String
Dim tString As String
Set cPrint = New clsMultiPgPreview
With frmPrinterSetUp
.fraOrientation.Visible = False
.Show vbModal
End With
If QuitCommand Then
QuitCommand = False
Exit Sub
End If
SendToPrinter:
cPrint.pStartDoc
cPrint.FontName = "Arial"
Title1 = "ADULT" & vbCrLf & "MEN 1"
Title2 = "18 - 21 Years Old"
RoomNumber = "230"
TechName = "Teacher: Morgan Haueisen"
Call PrintTag(True, RoomNumber, Title1, Title2, TechName, &H40C0&)
Title1 = "PRESCHOOL" & vbCrLf & "BABIES"
Title2 = "0 - 1 Year Old"
RoomNumber = "120"
TechName = "Teacher: Tammy Brown"
Call PrintTag(False, RoomNumber, Title1, Title2, TechName)
cPrint.pEndDoc
If cPrint.SendToPrinter Then GoTo SendToPrinter
Set cPrint = Nothing
End Sub
Private Sub PrintTag(PageTop As Boolean, _
ByVal RoomNumber As String, _
ByVal Title1 As String, _
ByVal Title2 As String, _
ByVal TeacherName As String, _
Optional ByVal fColor As Long = vbBlack)
Dim TopMargin As Single
If PageTop Then
TopMargin = 0
Else
TopMargin = cPrint.GetPaperHeight / 2
End If
cPrint.DrawWidth = 10
cPrint.pBox 0.25, TopMargin + 0.25, cPrint.GetPaperWidth - 0.5, (cPrint.GetPaperHeight / 2) - 0.5, fColor
cPrint.DrawWidth = 1
cPrint.pBox 0.25, TopMargin + 0.25, cPrint.GetPaperWidth - 0.5, 1, fColor, fColor, vbFSSolid
cPrint.FontBold = True
cPrint.ForeColor = vbWhite
cPrint.BackColor = fColor
cPrint.FontSize = 58
cPrint.CurrentY = TopMargin + 0.3
cPrint.pCenter RoomNumber
cPrint.BackColor = vbWhite
cPrint.ForeColor = fColor
cPrint.CurrentY = TopMargin + 1.5
cPrint.pCenterMultiline Title1, 0.5, cPrint.GetPaperWidth - 0.5, False
cPrint.FontSize = 36
cPrint.pCenter Title2
cPrint.FontBold = False
cPrint.FontItalic = True
cPrint.pPrint
cPrint.FontSize = 18
cPrint.CurrentY = TopMargin + (cPrint.GetPaperHeight / 2) - 1
cPrint.pCenterMultiline TeacherName, 0.5, cPrint.GetPaperWidth - 0.5, False
cPrint.FontItalic = False
End Sub
Private Sub Command5_Click()
Set cPrint = New clsMultiPgPreview
frmPrinterSetUp.Show vbModal
If QuitCommand Then
Set cPrint = Nothing
Exit Sub
End If
SendToPrinter:
Screen.MousePointer = vbHourglass
picPrinting.Visible = True
DoEvents
cPrint.pStartDoc
cPrint.pBox 0, 0
'/* Section 1
cPrint.pBox cPrint.GetPaperWidth - 1.25, 0.5, , 1.155
cPrint.CurrentY = 1.125
cPrint.pLine cPrint.GetPaperWidth - 1.25, , , False
cPrint.pBox 0, 0, , 1.655
cPrint.pBox 0, 0, , 1.675
cPrint.FontName = "Arial"
cPrint.FontSize = 8
cPrint.CurrentY = 0.53
cPrint.pPrint "HOUSE ORDER NO.", cPrint.GetPaperWidth - 1.2
cPrint.CurrentY = 1.13
cPrint.pPrint "DATE:", cPrint.GetPaperWidth - 1.2
cPrint.pPrintPicture LoadPicture(App.Path & "\JNJ.jpg"), 0.3, 0.25, , 1.25
cPrint.FontName = "Impact"
cPrint.FontSize = 18
cPrint.CurrentY = 0.8
cPrint.pPrint "R", cPrint.GetPaperWidth - 1.2
cPrint.FontSize = 22
cPrint.pPrint "HOUSE ORDER", 0.5, True
cPrint.FontName = "Arial"
cPrint.FontSize = 8
cPrint.p15Space
cPrint.pRightTab "(WORK IN PROCESS, NON-STANDARD GOODS OR RAW MATERIALS)", 1.5
cPrint.CurrentY = 0.6
cPrint.pPrintPicture LoadPicture(App.Path & "\arrow.bmp"), 6.2, 0.6, 0.5, 0.4, , False
cPrint.pMultiline "IN CASE OF INQUIRY, QUOTE THIS NUMBER", 5.25, 6.25
'/* Section 2
cPrint.pVerticalLine 0.375, 1.675, 3.53
cPrint.pVerticalLine 3.375, 1.675, 3.53
cPrint.pVerticalLine 3.75, 1.675, 3.53
cPrint.pVerticalLine 6.75, 1.675, 3.53
cPrint.CurrentY = 2.138
cPrint.pLine 0.375, 3.375, , False
cPrint.CurrentY = 2.602
cPrint.pLine 0.375, 3.375, , False
cPrint.CurrentY = 3.066
cPrint.pLine 0.375, 3.375, , False
cPrint.CurrentY = 2.138
cPrint.pLine 3.75, 6.75, , False
cPrint.CurrentY = 2.602
cPrint.pLine 3.75, 6.75, , False
cPrint.CurrentY = 3.066
cPrint.pLine 3.75, 6.75, , False
cPrint.CurrentY = 3.5
cPrint.pDoubleLine
cPrint.CurrentY = 1.7
cPrint.pPrint "NAME", 0.43
cPrint.CurrentY = 2.16
cPrint.pPrint "STREET", 0.43
cPrint.CurrentY = 2.627
cPrint.pPrint "CITY-STATE-ZIP CODE", 0.43
cPrint.CurrentY = 3.09
cPrint.pPrint "CUSTOMER ORDER NO.", 0.43
cPrint.CurrentY = 1.7
cPrint.pPrint "NAME", 3.8
cPrint.CurrentY = 2.16
cPrint.pPrint "STREET", 3.8
cPrint.CurrentY = 2.627
cPrint.pPrint "CITY-STATE-ZIP CODE", 3.8
cPrint.CurrentY = 3.09
cPrint.pPrint "ATTENTION", 3.8
cPrint.CurrentY = 1.7
cPrint.FontSize = 7
cPrint.pPrint "FOR OFFICAL USE ONLY", 6.8
cPrint.pLine 6.75
cPrint.CurrentY = 1.8
cPrint.FontSize = 10
cPrint.pPrint "S", 0.12
cPrint.pPrint "O", 0.12
cPrint.pPrint "L", 0.12
cPrint.pPrint "D", 0.12
cPrint.pPrint
cPrint.pPrint
cPrint.pPrint "T", 0.12
cPrint.pPrint "O", 0.12
cPrint.CurrentY = 1.8
cPrint.FontSize = 10
cPrint.pPrint "S", 3.52
cPrint.pPrint "H", 3.52
cPrint.pPrint "I", 3.52
cPrint.pPrint "P", 3.52
cPrint.pPrint
cPrint.pPrint
cPrint.pPrint "T", 3.52
cPrint.pPrint "O", 3.52
'/* Section 3
cPrint.CurrentY = 4.25
cPrint.pLine
cPrint.CurrentY = 4.75
cPrint.pLine
cPrint.CurrentY = 5.125
cPrint.pLine
cPrint.CurrentY = 5.5
cPrint.pLine
cPrint.CurrentY = 5.875
cPrint.pLine
cPrint.pVerticalLine 1, 3.56, 6.24
cPrint.CurrentY = 3.75
cPrint.FontSize = 8
cPrint.pPrint "BILLING", 0.1
cPrint.pPrint "INSTRUCTIONS", 0.1
cPrint.CurrentY = 4.4
cPrint.pPrint "OUTBOUND", 0.1
cPrint.pPrint "FREIGHT TERMS", 0.1
cPrint.CurrentY = 4.825
cPrint.pPrint "SHIPPING", 0.1
cPrint.pPrint "INSTRUCTIONS", 0.1
cPrint.CurrentY = 5.2
cPrint.pPrint "SPECIAL", 0.1
cPrint.pPrint "INSTRUCTIONS", 0.1
cPrint.CurrentY = 5.58
cPrint.pPrint "REASON FOR", 0.1
cPrint.pPrint "SHIPMENT", 0.1
cPrint.CurrentY = 5.95
cPrint.pPrint "POINT OF", 0.1
cPrint.pPrint "SHIPMENT", 0.1
cPrint.pVerticalLine 1.25, 3.7, 4.79
cPrint.pVerticalLine 2, 4.28, 4.79
cPrint.pVerticalLine 2.5, 4.28, 4.79
cPrint.pVerticalLine 3, 3.56, 4.79
cPrint.pVerticalLine 3.25, 3.8, 4.79
cPrint.CurrentY = 3.67
cPrint.pLine 1, 1.25
cPrint.CurrentY = 3.95
cPrint.pLine 1, 1.25
cPrint.CurrentY = 3.77
cPrint.pLine 3, 3.25
cPrint.CurrentY = 4.03
cPrint.pLine 3, 3.25
cPrint.CurrentY = 4.5
cPrint.pLine 3, 3.25
cPrint.pVerticalLine 4.2, 3.56, 4.5
cPrint.pBox 4.2, 4.28, 0.25, 0.25
cPrint.CurrentY = 3.77
cPrint.pPrint "NO CHARGES", 1.3
cPrint.CurrentY = 3.85
cPrint.pPrint "INVOICE", 3.3
cPrint.CurrentY = 4
cPrint.pPrint "DEBIT VENDOR FOR", 1.3
cPrint.pPrint "INBOUND FREIGHT CHGS.$", 1.3
cPrint.CurrentY = 4.1
cPrint.pPrint "PREPAY", 3.3
cPrint.CurrentY = 4.3
cPrint.pPrint "No. Cases", 1.3, True
cPrint.pPrint "Weight", 2.1, True
cPrint.pPrint "Charges", 2.55, True
cPrint.CurrentY = 4.35
cPrint.pPrint "COLLECT", 3.3
cPrint.CurrentY = 4.6
cPrint.pPrint "PREPAY", 3.3
cPrint.CurrentY = 4.3
cPrint.pMultiline "Prepay & Add Any Charge Freight To", 4.5, 5.25
cPrint.CurrentY = 4.5
cPrint.FontBold = True
cPrint.pPrint "138P", 5.3
cPrint.FontBold = False
cPrint.pVerticalLine 5.25, 3.56, 4.79
cPrint.pVerticalLine 5.625, 3.56, 4.79
cPrint.pVerticalLine 6.75, 3.56, 4.79
cPrint.pVerticalLine 7.375, 3.56, 4.79
cPrint.CurrentY = 3.6875
cPrint.pLine 4.2
cPrint.CurrentY = 3.98
cPrint.pLine 4.2
cPrint.CurrentY = 3.58
cPrint.pPrint "P/C", 5.3, True
cPrint.pPrint "DEPT.", 5.7, True
cPrint.pPrint "ACCT", 6.8, True
cPrint.pPrint "REF", 7.4
cPrint.CurrentY = 3.73
cPrint.pPrint "DEBIT", 4.25
cPrint.pPrint "ACCOUNT NO.", 4.25
cPrint.CurrentY = 4.01
cPrint.pPrint "CREDIT", 4.25
cPrint.pPrint "ACCOUNT NO.", 4.25
cPrint.pBox 1, 4.84, 0.25, 0.25
cPrint.pBox 3, 4.84, 0.25, 0.25
cPrint.pBox 5, 4.84, 0.25, 0.25
cPrint.CurrentY = 4.9
cPrint.pPrint "AT ONCE", 1.3, True
cPrint.pPrint "ON OR BEFORE", 3.3, True
cPrint.pPrint "ON OR AFTER", 5.3
cPrint.CurrentY = 6.2
cPrint.pDoubleLine
'/* Section 4
cPrint.CurrentY = 9.625
cPrint.pDoubleLine
picPrinting.Visible = False
Screen.MousePointer = vbDefault
cPrint.pEndDoc
If cPrint.SendToPrinter Then GoTo SendToPrinter
Set cPrint = Nothing
End Sub
Private Sub Command6_Click()
Dim i As Integer
Set cPrint = New clsMultiPgPreview
With frmPrinterSetUp
.fraOrientation.Visible = False
.cmdPrint.Visible = False
.Show vbModal
End With
If QuitCommand Then
Set cPrint = Nothing
Exit Sub
End If
cPrint.Orientation = PageLandscape
cPrint.SendToPrinter = False
picPrinting.Visible = True
MousePointer = vbHourglass
DoEvents
SendToPrinter:
cPrint.pStartDoc
cPrint.FontSize = 11
GoSub PrintHeader
cPrint.pPrint "cPrint.Orientation = PageLandscape", 0.5
cPrint.pPrint "cPrint.SendToPrinter = False", 0.5
cPrint.FontBold = True
cPrint.pPrint "The following text is in the Multi-Line Textbox (Text1)", 0.5
cPrint.FontBold = False
cPrint.pPrint
cPrint.pMultiline Text1.Text, 2, 6, , , True
cPrint.pFooter
picPrinting.Visible = False
MousePointer = vbDefault
cPrint.pEndDoc
If cPrint.SendToPrinter Then GoTo SendToPrinter
Set cPrint = Nothing
Exit Sub
PrintHeader:
cPrint.pHeader "EndOfPage Check Demo", "(print a textbox that runs across several pages)"
Return
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
picPrinting.Move Command1.Left - 500, Command1.Top - 100
ChDir App.Path
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -