peteeng
Chemical
- Apr 30, 2003
- 4
I have written the following VB code(simplified) for printing output summary of a program that I have written, what I like to do is to be able to preview the output before it actually prints to the printer. Can anybody help me out??? Thanks you
Private Sub CmdPrint_Click()
Cust = txtName.Text
CustRef = txtCustRef.Text
Proj = txtProj.Text
Engr = txtEngr.Text
Offer = txtOffer.Text
Job = txtJob.Text
sFileName = txtFile.Text
Printer.ScaleMode = 5
dXOffSet = (Printer.Width / 1444 - Printer.ScaleWidth) / 2
dYOffSet = 5 / 16
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1 - dYOffSet
Printer.DrawWidth = 10
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.Line -(Printer.CurrentX, Printer.CurrentY + 9.5)
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1 - dYOffSet
Printer.Line -(Printer.CurrentX, Printer.CurrentY + 9.5)
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1.725 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1.75 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 6 - dXOffSet
Printer.CurrentY = 1.75 - dYOffSet
Printer.Line -(Printer.CurrentX, Printer.CurrentY + 1)
Printer.CurrentY = 0.75 - dYOffSet
Printer.FontName = "Times New Roman"
Printer.FontSize = 18
Printer.Print Tab(25); "DESIGN & SIZING INFORMATION"
Printer.FontSize = 12
Printer.Print Tab(50); "WITH ALL THE TRIMMINGS"
Printer.FontSize = 9
Printer.Print Tab(72); "By: Authors"
Printer.FontSize = 10
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 1.8 - dYOffSet
Printer.Print "CLIENT :"; Tab(35); Cust; Tab(105); "DESIGNED BY :"; Tab(125); Engr
Printer.DrawWidth = 1
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 2.05 - dYOffSet
Printer.Print "REFERENCE :"; Tab(35); CustRef; Tab(105); "OFFER NO. :"; Tab(125); Offer
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2.25 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 2.3 - dYOffSet
Printer.Print "PROJECT :"; Tab(35); Proj; Tab(105); "JOB NO. :"; Tab(125); Job
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2.5 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 2.55 - dYOffSet
' Printer.Print Tab(105); "FILE NO. :"; Tab(125); File
Printer.Print "DESIGN BY :"; Tab(35); Engr; Tab(105); "FILE NO. :"; Tab(125); sFileName
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2.75 - dYOffSet
Printer.DrawWidth = 10
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentY = 2.6 - dYOffSet
Printer.FontSize = 11
Printer.FontBold = True
Printer.Print Tab(50); "PROCESS DESIGN CONDITIONS"
Printer.FontBold = False
Printer.EndDoc
End Sub
Private Sub CmdPrint_Click()
Cust = txtName.Text
CustRef = txtCustRef.Text
Proj = txtProj.Text
Engr = txtEngr.Text
Offer = txtOffer.Text
Job = txtJob.Text
sFileName = txtFile.Text
Printer.ScaleMode = 5
dXOffSet = (Printer.Width / 1444 - Printer.ScaleWidth) / 2
dYOffSet = 5 / 16
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1 - dYOffSet
Printer.DrawWidth = 10
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.Line -(Printer.CurrentX, Printer.CurrentY + 9.5)
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1 - dYOffSet
Printer.Line -(Printer.CurrentX, Printer.CurrentY + 9.5)
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1.725 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 1.75 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 6 - dXOffSet
Printer.CurrentY = 1.75 - dYOffSet
Printer.Line -(Printer.CurrentX, Printer.CurrentY + 1)
Printer.CurrentY = 0.75 - dYOffSet
Printer.FontName = "Times New Roman"
Printer.FontSize = 18
Printer.Print Tab(25); "DESIGN & SIZING INFORMATION"
Printer.FontSize = 12
Printer.Print Tab(50); "WITH ALL THE TRIMMINGS"
Printer.FontSize = 9
Printer.Print Tab(72); "By: Authors"
Printer.FontSize = 10
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 1.8 - dYOffSet
Printer.Print "CLIENT :"; Tab(35); Cust; Tab(105); "DESIGNED BY :"; Tab(125); Engr
Printer.DrawWidth = 1
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 2.05 - dYOffSet
Printer.Print "REFERENCE :"; Tab(35); CustRef; Tab(105); "OFFER NO. :"; Tab(125); Offer
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2.25 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 2.3 - dYOffSet
Printer.Print "PROJECT :"; Tab(35); Proj; Tab(105); "JOB NO. :"; Tab(125); Job
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2.5 - dYOffSet
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentX = 1.1 - dXOffSet
Printer.CurrentY = 2.55 - dYOffSet
' Printer.Print Tab(105); "FILE NO. :"; Tab(125); File
Printer.Print "DESIGN BY :"; Tab(35); Engr; Tab(105); "FILE NO. :"; Tab(125); sFileName
Printer.CurrentX = 1 - dXOffSet
Printer.CurrentY = 2.75 - dYOffSet
Printer.DrawWidth = 10
Printer.Line -(Printer.CurrentX + 7, Printer.CurrentY)
Printer.CurrentY = 2.6 - dYOffSet
Printer.FontSize = 11
Printer.FontBold = True
Printer.Print Tab(50); "PROCESS DESIGN CONDITIONS"
Printer.FontBold = False
Printer.EndDoc
End Sub