PrinterCE
SDK Special Topics
.Net CF C# or VB.Net: Printing Utilities |
Option Explicit Const vbLeft=0 Const vbRight=1 Const vbCenter=2 Const vbTop=0 Const vbBottom=2 Const vbTwips = 1 Const vbPoints = 2 Const vbPixels = 3 Const vbInches = 5 Const vbMillimeters = 6 Const vbCentimeters = 7 '-------------------------------------- Dim PrinterCE1 Set PrinterCE1 = CreateObject("PrEngineCE.PrinterCE") ImageWheel ' Call our subroutine '-------------------------------------- private sub ImageWheel ' Demo rotations of images PrinterCE1.SelectPrinter PrinterCE1.ScaleMode = vbInches 'Lets do everything in inches Dim x, y, x2, y2, length, i, imagestr imagestr = "\Images\Owl.bmp" x = PrinterCE1.PrPgWidth / 2 PrinterCE1.TextX = x PrinterCE1.JustifyHoriz = 2 PrinterCE1.DrawText "ImageWheel Demo" PrinterCE1.JustifyHoriz = 0 y = 1.7 For i = 0 To 3 'Justification defaults to Left & Top PrinterCE1.Rotation = i 'Rotate North, East, South, West PrinterCE1.DrawPicture imagestr, x, y, 1.5, 1.5, True Next 'Now draw rectangle and do lower-right for each image y = 4 length = 2.5 x = x - 3.25 x2 = x + length y2 = y + length PrinterCE1.DrawRect x, y, x2, y2 'Set horiz/vert justification to bottom/right PrinterCE1.JustifyVert = vbBottom PrinterCE1.JustifyHoriz = vbRight 'Now print 4 images rotated in the rectangle PrinterCE1.Rotation = 0 'North PrinterCE1.DrawPicture imagestr, x2, y2, 1, 1, True PrinterCE1.Rotation = 1 ' East PrinterCE1.DrawPicture imagestr, x, y2, 1, 1, True PrinterCE1.Rotation = 2 'South PrinterCE1.DrawPicture imagestr, x, y, 1, 1, True PrinterCE1.Rotation = 3 'West PrinterCE1.DrawPicture imagestr, x2, y, 1, 1, True 'Now do same thing but center each image at the corner of rectangle x = x + 3.75 x2 = x + length PrinterCE1.DrawRect x, y, x2, y2 'Set horiz/vert justification to center/center PrinterCE1.JustifyVert = vbCenter PrinterCE1.JustifyHoriz = vbCenter 'Now print 4 images rotated in the rectangle PrinterCE1.Rotation = 0 'North PrinterCE1.DrawPicture imagestr, x2, y2, 1, 1, True PrinterCE1.Rotation = 1 ' East PrinterCE1.DrawPicture imagestr, x, y2, 1, 1, True PrinterCE1.Rotation = 2 'South PrinterCE1.DrawPicture imagestr, x, y, 1, 1, True PrinterCE1.Rotation = 3 'West PrinterCE1.DrawPicture imagestr, x2, y, 1, 1, True PrinterCE1.EndDoc End Sub |