home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD53124282000.psc / modPrint.bas < prev    next >
Encoding:
BASIC Source File  |  2000-04-28  |  10.3 KB  |  349 lines

  1. Attribute VB_Name = "modPrint"
  2. '####################################################
  3. '#      ALL code was created by Andy McCurtin       #
  4. '#  This code took me a long time to perfect (and a #
  5. '#  rainforests worth of paper)                     #
  6. '#  It was not created to be used for any illegal   #
  7. '#  purposes, however what you do with it is your   #
  8. '#  business and I take no responsibility for your  #
  9. '#  actions.                                        #
  10. '#  If you improve this code please send me a copy  #
  11. '#    (How often do people actually do this ????)   #
  12. '#                                                  #
  13. '#  Please do not plagiarise my code, I like many   #
  14. '#  other people spend time on our programs so      #
  15. '#  others can learn from them and when brainless   #
  16. '#  Wa**ers steal our work and put their names on   #
  17. '#  it and then have the audacity to take credit    #
  18. '#  for it being their own, it it makes you think   #
  19. '#  twice before giving any more code away incase   #
  20. '#  these idiots steal that as well.                #
  21. '#  (As you may have gathered I have had my work    #
  22. '#  plagiarised in the past and I had to think long #
  23. '#  and hard before uploading this code)            #
  24. '#                                                  #
  25. '#  Anyway enough preaching (I've got WAY TOO much  #
  26. '#  tequila and vodka in my system)                 #
  27. '#  Any problems with this code please e-mail me    #
  28. '#  Any questions please e-mail, I'll try to help   #
  29. '#                                                  #
  30. '#              andy_mccurtin@yahoo.com             #
  31. '#                                                  #
  32. '#  It's 02:02am GMT I've been drinking way too     #
  33. '#  long, and can hardly see straight so I leave    #
  34. '#  you with these words of wisdom...               #
  35. '#  U're my bestest mate in d wurld!!!!! and I lurv #
  36. '#  ya.......... DRROOOOOLLLL... ZZZZZZZZZZZZZZZ    #
  37. '#                                                  #
  38. '#  P.S  I really should stop drinking when I       #
  39. '#  program                                         #
  40. '####################################################
  41.  
  42.  
  43. '//When printing an image the format I have used is as
  44. '//follows :-
  45. '//Printer.PaintPicture Image1.Picture, X1, Y1, Width1, _
  46. '//     Height1
  47. '//
  48. '// Image1 stretch proprty should be set to True
  49. '// X1 is the Left margin (how big a space from the left
  50. '// edge of the paper)
  51. '// Y1 is the Top margin (how big a space from the top
  52. '// of the page)
  53. '// Width1 is the width of the image being printed
  54. '// Height1 is the height of the image being printed
  55. '//
  56. '// When you see frmMain!img###### this allows you to use
  57. '// a control on Form frmMain (you can call any control)
  58. '//
  59. '// 1440 Twips = (Approx) 1 inch
  60. '//
  61. '// CD cover measurments are as follows :-
  62. '// Front Cover = W6900, H6900
  63. '// Inside Cover = W6900, H6900
  64. '// Front & Inside Cover as one = W13800 , H6900
  65. '// Back Cover = W8530, H6700
  66.  
  67. Option Explicit
  68. Public prnCopies As Integer
  69.  
  70. '//Print ONLY front cover
  71. Public Sub PrintFront()
  72. 'Variables
  73. Dim TopMargin As Integer
  74. Dim LeftMargin As Integer
  75. Dim Width As Integer
  76. Dim Height As Integer
  77.         
  78.     'assigns values (in twips) to variables
  79.     TopMargin = 1440
  80.     LeftMargin = 1440
  81.     Width = 6900
  82.     Height = 6900
  83.           
  84.     Printer.Orientation = 1 'Prints in protrait
  85.     
  86.     If prnCopies = 0 Then
  87.         Printer.copies = 1
  88.     Else
  89.         Printer.copies = prnCopies 'no of copies to print
  90.     End If
  91.    
  92.     Printer.PaintPicture frmMain!imgFront.Picture, _
  93.         LeftMargin, TopMargin, Width, Height
  94.     
  95.     Printer.EndDoc 'without this nothing will print until the program closes
  96. End Sub
  97.  
  98. '//Print ONLY back cover
  99. Public Sub PrintBack()
  100. 'Variables
  101. Dim bTopMargin As Integer
  102. Dim bLeftMargin As Integer
  103. Dim bWidth As Integer
  104. Dim bHeight As Integer
  105.     
  106.     'assigns values (in twips) to variables
  107.     bTopMargin = 1440
  108.     bLeftMargin = 1440
  109.     bWidth = 8530
  110.     bHeight = 6700
  111.     
  112.     Printer.Orientation = 1 'Prints in Portrait
  113.     
  114.     If prnCopies = 0 Then
  115.         Printer.copies = 1
  116.     Else
  117.         Printer.copies = prnCopies 'no of copies to print
  118.     End If
  119.     
  120.     Printer.PaintPicture frmMain!imgBack.Picture, bLeftMargin, _
  121.         bTopMargin, bWidth, bHeight
  122.     
  123.     Printer.EndDoc 'without this nothing will print until the program closes
  124. End Sub
  125.  
  126.  
  127. '//Print ONLY front and inside (separate) covers
  128. Public Sub PrintFrontAndInside()
  129. 'Variables
  130. Dim FrontTopMargin As Integer
  131. Dim FrontLeftMargin As Integer
  132. Dim FrontWidth As Integer
  133. Dim FrontHeight As Integer
  134. Dim InsideTopMargin As Integer
  135. Dim InsideLeftMargin As Integer
  136. Dim InsideWidth As Integer
  137. Dim InsideHeight As Integer
  138.     
  139.     'assigns values (in twips) to variables
  140.     FrontTopMargin = 1000
  141.     FrontLeftMargin = 6900 + 1010
  142.     FrontWidth = 6900
  143.     FrontHeight = 6900
  144.     
  145.     'assigns values (in twips) to variables
  146.     InsideTopMargin = 1000
  147.     InsideLeftMargin = 1000
  148.     InsideWidth = 6900
  149.     InsideHeight = 6900
  150.     
  151.     Printer.Orientation = 2 'Prints in Landscape
  152.     
  153.     If prnCopies = 0 Then
  154.         Printer.copies = 1
  155.     Else
  156.         Printer.copies = prnCopies 'no of copies to print
  157.     End If
  158.     
  159.     Printer.PaintPicture frmMain!imgFrontS.Picture, FrontLeftMargin, _
  160.     FrontTopMargin, FrontWidth, FrontHeight
  161.     
  162.     Printer.PaintPicture frmMain!imgInsideS.Picture, InsideLeftMargin, _
  163.         InsideTopMargin, InsideWidth, InsideHeight
  164.     
  165.     Printer.EndDoc 'without this nothing will print until the program closes
  166. End Sub
  167.  
  168.  
  169. '//Print Front and Inside (Whole) cover
  170. Public Sub PrintWhole()
  171. 'Variables
  172. Dim WholeTopMargin As Integer
  173. Dim WholeLeftMargin As Integer
  174. Dim WholeWidth As Integer
  175. Dim WholeHeight As Integer
  176.     
  177.     'assigns values (in twips) to variables
  178.     WholeTopMargin = 1440
  179.     WholeLeftMargin = 1440
  180.     WholeWidth = 13800
  181.     WholeHeight = 6900
  182.     
  183.     Printer.Orientation = 2 'Prints in Landscape
  184.     
  185.     If prnCopies = 0 Then
  186.         Printer.copies = 1
  187.     Else
  188.         Printer.copies = prnCopies 'no of copies to print
  189.     End If
  190.     
  191.     Printer.PaintPicture frmMain!imgFront_Inside_W.Picture, WholeLeftMargin, _
  192.     WholeTopMargin, WholeWidth, WholeHeight
  193.  
  194.     Printer.EndDoc 'without this nothing will print until the program closes
  195. End Sub
  196.  
  197.  
  198. '//Print ONLY Front and Back covers
  199. Public Sub PrintFrontAndBack()
  200. 'Variables
  201. Dim FrontTopMargin As Integer
  202. Dim FrontLeftMargin As Integer
  203. Dim FrontWidth As Integer
  204. Dim FrontHeight As Integer
  205. Dim BackTopMargin As Integer
  206. Dim BackLeftMargin As Integer
  207. Dim BackWidth As Integer
  208. Dim BackHeight As Integer
  209.  
  210.     'assigns values (in twips) to variables
  211.     FrontTopMargin = 1000
  212.     FrontLeftMargin = 1440 + 720
  213.     FrontWidth = 6900
  214.     FrontHeight = 6900
  215.     
  216.     'assigns values (in twips) to variables
  217.     BackTopMargin = 6900 + 1440
  218.     BackLeftMargin = 1440
  219.     BackWidth = 8530
  220.     BackHeight = 6700
  221.     
  222.     If prnCopies = 0 Then
  223.         Printer.copies = 1
  224.     Else
  225.         Printer.copies = prnCopies 'no of copies to print
  226.     End If
  227.     
  228.     Printer.PaintPicture frmMain!imgFront.Picture, FrontLeftMargin, _
  229.     FrontTopMargin, FrontWidth, FrontHeight
  230.     
  231.     Printer.PaintPicture frmMain!imgBack.Picture, BackLeftMargin, _
  232.         BackTopMargin, BackWidth, BackHeight
  233.     
  234.     Printer.EndDoc 'without this nothing will print until the program closes
  235. End Sub
  236.  
  237.  
  238. '//Print Front and Inside (Separate) and Back covers
  239. Public Sub PrintFrontsAndInsideSAndBack()
  240. 'Fron and Inside Variables
  241. Dim FrontTopMargin As Integer
  242. Dim FrontLeftMargin As Integer
  243. Dim FrontWidth As Integer
  244. Dim FrontHeight As Integer
  245. Dim InsideTopMargin As Integer
  246. Dim InsideLeftMargin As Integer
  247. Dim InsideWidth As Integer
  248. Dim InsideHeight As Integer
  249. 'Back Variables
  250. Dim bTopMargin As Integer
  251. Dim bLeftMargin As Integer
  252. Dim bWidth As Integer
  253. Dim bHeight As Integer
  254.  
  255.     
  256.     'assigns values (in twips) to variables
  257.     FrontTopMargin = 1000
  258.     FrontLeftMargin = 6900 + 1010
  259.     FrontWidth = 6900
  260.     FrontHeight = 6900
  261.     
  262.     'assigns values (in twips) to variables
  263.     InsideTopMargin = 1000
  264.     InsideLeftMargin = 1000
  265.     InsideWidth = 6900
  266.     InsideHeight = 6900
  267.     
  268.     Printer.Orientation = 2 'Prints in Landscape
  269.     
  270.     If prnCopies = 0 Then
  271.         Printer.copies = 1
  272.     Else
  273.         Printer.copies = prnCopies 'no of copies to print
  274.     End If
  275.     
  276.     Printer.PaintPicture frmMain!imgFrontS.Picture, FrontLeftMargin, _
  277.     FrontTopMargin, FrontWidth, FrontHeight
  278.     
  279.     Printer.PaintPicture frmMain!imgInsideS.Picture, InsideLeftMargin, _
  280.         InsideTopMargin, InsideWidth, InsideHeight
  281.     
  282.     Printer.NewPage 'Begins new page for back cover
  283.         
  284.     'assigns values (in twips) to variables
  285.     bTopMargin = 1440
  286.     bLeftMargin = 1440
  287.     bWidth = 8530
  288.     bHeight = 6700
  289.     
  290.     Printer.Orientation = 1 'Prints in Portrait
  291.     
  292.     Printer.PaintPicture frmMain!imgBack.Picture, bLeftMargin, _
  293.         bTopMargin, bWidth, bHeight
  294.     
  295.     Printer.EndDoc 'without this nothing will print until the program closes
  296.     
  297. End Sub
  298.  
  299.  
  300. '//Print Front and Inside (whole) and Back covers
  301. Public Sub PrintWholeAndBack()
  302. 'Whole Variables
  303. Dim WholeTopMargin As Integer
  304. Dim WholeLeftMargin As Integer
  305. Dim WholeWidth As Integer
  306. Dim WholeHeight As Integer
  307.     
  308. 'Back Variables
  309. Dim bTopMargin As Integer
  310. Dim bLeftMargin As Integer
  311. Dim bWidth As Integer
  312. Dim bHeight As Integer
  313.     
  314.     
  315.     'assigns values (in twips) to variables
  316.     WholeTopMargin = 1440
  317.     WholeLeftMargin = 1440
  318.     WholeWidth = 13800
  319.     WholeHeight = 6900
  320.         
  321.     Printer.Orientation = 2 'Prints in Landscape
  322.     
  323.     If prnCopies = 0 Then
  324.         Printer.copies = 1
  325.     Else
  326.         Printer.copies = prnCopies 'no of copies to print
  327.     End If
  328.     
  329.     Printer.PaintPicture frmMain!imgFront_Inside_W.Picture, WholeLeftMargin, _
  330.     WholeTopMargin, WholeWidth, WholeHeight
  331.     
  332.     Printer.NewPage 'Begins new page for back cover
  333.     
  334.     'assigns values (in twips) to variables
  335.     bTopMargin = 1440
  336.     bLeftMargin = 1440
  337.     bWidth = 8530
  338.     bHeight = 6700
  339.     
  340.     Printer.Orientation = 1 'Prints in Portrait
  341.     
  342.     Printer.PaintPicture frmMain!imgBack.Picture, bLeftMargin, _
  343.         bTopMargin, bWidth, bHeight
  344.     
  345.     Printer.EndDoc 'without this nothing will print until the program closes
  346.     
  347. End Sub
  348.  
  349.