PrinterCE
SDK Special Topics
.Net CF C# or VB.Net: Printing Utilities |
Option Explicit Const vbLeft=0 Const vbRight=1 Const vbCenter=2 '-------------------------------------- Dim PrinterCE1 Set PrinterCE1 = CreateObject("PrEngineCE.PrinterCE") DemoLines' Call our subroutine '-------------------------------------- Private Sub DemoLines() PrinterCE1.SelectPrinter Dim wd, ht, x1, y1, x2, y2 wd = PrinterCE1.PrPgWidth 'Center vertically & horizontally PrinterCE1.JustifyHoriz = vbCenter PrinterCE1.JustifyVert = vbCenter 'Set font stuff PrinterCE1.FontName = "Courier New" PrinterCE1.FontSize = 36 PrinterCE1.FontItalic = True PrinterCE1.ForeColor = &H800080 PrinterCE1.DrawText "Demo: Line Fun", wd / 2, 720 'Rectangle area - width of page by 2 inches ' ScaleMode defaults to TWIPS - (1440 twips per inch) x1 = 0 x2 = wd y1 = 1440 ht = 2 * 1440 y2 = y1 + ht PrinterCE1.DrawWidth = 72 ' 72 twips = 1/5 of an inch PrinterCE1.DrawRect x1, y1, x2, y2 PrinterCE1.DrawWidth = 10 Dim deltax, deltay, offsetx, offsety, lp deltax = wd / 25 deltay = ht / 25 offsetx = 0 offsety = y2 For lp = 0 To 24 offsetx = offsetx + deltax PrinterCE1.DrawLine x1 + offsetx, y1, x1, offsety PrinterCE1.DrawLine x2 - offsetx, y1, x2, offsety offsety = offsety - deltay Next 'Put an ellipse filled with a color inside our rectangle PrinterCE1.DrawWidth = 20 PrinterCE1.FillStyle = 0 'picFSSolid PrinterCE1.FillColor = &HF0FF 'calc new y1 & y2 y1 = y1 + 720 y2 = y2 - 120 x1 = wd / 2 PrinterCE1.DrawEllipse x1 - wd / 3, y1, x1 + wd / 3, y2 'Put some text in the middle PrinterCE1.ForeColor = &HFF0000 PrinterCE1.FontSize = 32 PrinterCE1.FontName = "Arial" PrinterCE1.DrawText "What's Up?", x1, y1 + (y2 - y1) / 2 PrinterCE1.EndDoc End Sub |