PrinterCE
SDK Special Topics
.Net CF C# or VB.Net: Printing Utilities |
Option Explicit Const vbLeft=0 Const vbRight=1 Const vbCenter=2 Const vbTwips = 1 Const vbPoints = 2 Const vbPixels = 3 Const vbInches = 5 Const vbMillimeters = 6 Const vbCentimeters = 7 Const vbPortrait=1 Const vbLandscape=2 Const vbLightGray=&HC0C0C0 Const vbDarkGray=&H101010 '-------------------------------------- Dim PrinterCE1 Set PrinterCE1 = CreateObject("PrEngineCE.PrinterCE") '---------------------------------------------- Private Sub FormTest() PrinterCE1.SelectPrinter PrinterCE1.PrOrientation = vbPortrait 'Force to portrait mode PrinterCE1.ScaleMode = vbInches 'Everything in inces PrinterCE1.PrLeftMargin = 0.5 PrinterCE1.PrTopMargin = 0.7 PrinterCE1.PrRightMargin = 0.5 PrinterCE1.PrBottomMargin = 0.7 PrinterCE1.DrawWidth = 0.02 'Force printer margins to 1/2" all around 'Draw major rectangles and lines PrinterCE1.DrawRect 0, 0, 5.7, 0.5 'Draw a shaded rectangle PrinterCE1.FillColor = vbLightGray PrinterCE1.FillStyle = 0 'picFSSolid PrinterCE1.DrawRect 0, 0, 5.7, 0.25 PrinterCE1.DrawLine 2, 0, 2, 0.5 PrinterCE1.DrawLine 3.8, 0, 3.8, 0.5 'Draw text strings PrinterCE1.FontSize = 12 PrinterCE1.FontBold = True PrinterCE1.ForeColor = vbBlack PrinterCE1.JustifyHoriz = vbCenter PrinterCE1.JustifyVert = vbCenter PrinterCE1.DrawText "Account Number", 1, 0.125 PrinterCE1.DrawText "Meter Number", 2.9, 0.125 PrinterCE1.DrawText "Payment Due By", 4.75, 0.125 'Draw dark box with clear inner box PrinterCE1.FillColor = vbDarkGray PrinterCE1.DrawRect 5.7, 0, 7.5, 0.7 PrinterCE1.ForeColor = vbWhite PrinterCE1.FontSize = 9 PrinterCE1.FontBoldVal = 1000 'As bold as possible PrinterCE1.DrawText "PLEASE PAY THIS AMOUNT", 6.6, 0.1 PrinterCE1.FillColor = vbWhite PrinterCE1.DrawRoundedRect 5.8, 0.2, 7.4, 0.6, 0.15, 0.15 PrinterCE1.ForeColor = vbBlack PrinterCE1.FontSize = 12 PrinterCE1.FontBold = False PrinterCE1.DrawRect 4, 0.9, 7.5, 1.7 PrinterCE1.DrawLine 4, 1.1, 6.2, 1.1 PrinterCE1.DrawLine 4, 1.3, 7.5, 1.3 PrinterCE1.DrawLine 5.1, 1.1, 5.1, 1.7 PrinterCE1.DrawLine 6.2, 0.9, 6.2, 1.7 PrinterCE1.DrawText "METER READINGS", 5.1, 1 PrinterCE1.DrawText "USAGE", 6.85, 1 PrinterCE1.DrawText "Cubic Feet", 6.85, 1.2 PrinterCE1.DrawRect 5, 1.9, 7.5, 2.6 PrinterCE1.DrawText "To avoid Late Payment charge,", 6.25, 2.05 PrinterCE1.DrawText "full payment must be received by", 6.25, 2.25 PrinterCE1.JustifyHoriz = vbLeft PrinterCE1.FontSize = 8 PrinterCE1.DrawText "PLEASE RETURN THIS STUB WITH PAYMENT", 0, 2.8 PrinterCE1.JustifyHoriz = vbRight PrinterCE1.DrawText "TO ENSURE PROPER CREDIT, PLEASE WRITE YOUR ACCOUNT NUMBER ON YOU CHECK.", 7.5, 2.8 PrinterCE1.FontSize = 14 PrinterCE1.FontBold = True PrinterCE1.FontItalic = True PrinterCE1.JustifyHoriz = vbCenter PrinterCE1.DrawText "THANK YOU FOR YOUR PROMPT PAYMENT", 2.5, 2.5 ' Fill in customer specific data here - could be database driven PrinterCE1.FontBold = False PrinterCE1.FontItalic = False PrinterCE1.DrawText "06-036171-408", 1, 0.375 PrinterCE1.DrawText "R52581782D-AB", 2.9, 0.375 PrinterCE1.DrawText "09-22-99", 4.75, 0.375 PrinterCE1.FontSize = 16 PrinterCE1.FontBold = True PrinterCE1.DrawText "$70.01", 6.6, 0.4 PrinterCE1.FontSize = 12 PrinterCE1.FontBold = False PrinterCE1.DrawText "09-22-99", 6.25, 2.45 PrinterCE1.DrawText "06-15-99", 4.55, 1.2 PrinterCE1.DrawText "08-17-99", 5.65, 1.2 PrinterCE1.FontSize = 14 PrinterCE1.DrawText "145,990", 4.55, 1.5 PrinterCE1.DrawText "151,280", 5.65, 1.5 PrinterCE1.DrawText "5,290", 6.85, 1.5 PrinterCE1.JustifyHoriz = vbLeft PrinterCE1.FontSize = 16 PrinterCE1.DrawText "John Doe Smith", 0.5, 1.2 PrinterCE1.DrawText "12345 Main Street" PrinterCE1.DrawText "Camino, CA. 95709-5555" PrinterCE1.DrawWidth = 0.01 'Draw very thin line PrinterCE1.DrawLine 0, 3, 7.5, 3 PrinterCE1.EndDoc End Sub |