home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / VIEWERS / VSVIEW / VSVIEW.ZIP / FEZPRINT.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-12-27  |  27.0 KB  |  811 lines

  1. VERSION 2.00
  2. Begin Form fEZPrint 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "VSPrinter: a smarter Replacement for the Printer Object"
  6.    ClientHeight    =   6240
  7.    ClientLeft      =   1185
  8.    ClientTop       =   540
  9.    ClientWidth     =   7515
  10.    Height          =   6705
  11.    Left            =   1095
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   6240
  16.    ScaleWidth      =   7515
  17.    Top             =   165
  18.    Width           =   7695
  19.    Begin vsViewPort vsViewPort2 
  20.       BackColor       =   &H00808080&
  21.       ConvInfo        =   FEZPRINT.FRX:0000
  22.       Height          =   3735
  23.       LargeChangeVert =   900
  24.       Left            =   255
  25.       Top             =   585
  26.       VirtualHeight   =   7400
  27.       VirtualWidth    =   0
  28.       Width           =   1905
  29.       Begin CommandButton Command1 
  30.          BackColor       =   &H00808080&
  31.          Caption         =   "Table of Cont."
  32.          Height          =   500
  33.          Index           =   12
  34.          Left            =   135
  35.          TabIndex        =   17
  36.          Top             =   2520
  37.          Width           =   1380
  38.       End
  39.       Begin CommandButton Command1 
  40.          BackColor       =   &H00808080&
  41.          Caption         =   "Fancy Table"
  42.          Height          =   500
  43.          Index           =   11
  44.          Left            =   120
  45.          TabIndex        =   16
  46.          Top             =   1920
  47.          Width           =   1380
  48.       End
  49.       Begin CommandButton Command1 
  50.          BackColor       =   &H00808080&
  51.          Caption         =   "Line by Line"
  52.          Height          =   500
  53.          Index           =   0
  54.          Left            =   120
  55.          TabIndex        =   3
  56.          Top             =   105
  57.          Width           =   1380
  58.       End
  59.       Begin CommandButton Command1 
  60.          BackColor       =   &H00808080&
  61.          Caption         =   "Paragraph"
  62.          Height          =   500
  63.          Index           =   1
  64.          Left            =   120
  65.          TabIndex        =   4
  66.          Top             =   720
  67.          Width           =   1380
  68.       End
  69.       Begin CommandButton Command1 
  70.          BackColor       =   &H00808080&
  71.          Caption         =   "Tables"
  72.          Height          =   500
  73.          Index           =   2
  74.          Left            =   120
  75.          TabIndex        =   5
  76.          Top             =   1320
  77.          Width           =   1380
  78.       End
  79.       Begin CommandButton Command1 
  80.          BackColor       =   &H00808080&
  81.          Caption         =   "Multi-Column"
  82.          Height          =   500
  83.          Index           =   3
  84.          Left            =   120
  85.          TabIndex        =   6
  86.          Top             =   3135
  87.          Width           =   1380
  88.       End
  89.       Begin CommandButton Command1 
  90.          BackColor       =   &H00808080&
  91.          Caption         =   "Draw"
  92.          Height          =   500
  93.          Index           =   4
  94.          Left            =   120
  95.          TabIndex        =   10
  96.          Top             =   5535
  97.          Width           =   1380
  98.       End
  99.       Begin CommandButton Command1 
  100.          BackColor       =   &H00808080&
  101.          Caption         =   "&AlignText"
  102.          Height          =   500
  103.          Index           =   5
  104.          Left            =   120
  105.          TabIndex        =   7
  106.          Top             =   3735
  107.          Width           =   1380
  108.       End
  109.       Begin CommandButton Command1 
  110.          BackColor       =   &H00808080&
  111.          Caption         =   "&Indent"
  112.          Height          =   500
  113.          Index           =   6
  114.          Left            =   120
  115.          TabIndex        =   8
  116.          Top             =   4335
  117.          Width           =   1380
  118.       End
  119.       Begin CommandButton Command1 
  120.          BackColor       =   &H00808080&
  121.          Caption         =   "&Mail Merge"
  122.          Height          =   500
  123.          Index           =   7
  124.          Left            =   120
  125.          TabIndex        =   9
  126.          Top             =   4935
  127.          Width           =   1380
  128.       End
  129.       Begin CommandButton Command1 
  130.          BackColor       =   &H00808080&
  131.          Caption         =   "&Graphics"
  132.          Height          =   500
  133.          Index           =   8
  134.          Left            =   120
  135.          TabIndex        =   11
  136.          Top             =   6135
  137.          Width           =   1380
  138.       End
  139.       Begin CommandButton Command1 
  140.          BackColor       =   &H00808080&
  141.          Caption         =   "Angle"
  142.          Height          =   500
  143.          Index           =   10
  144.          Left            =   120
  145.          TabIndex        =   12
  146.          Top             =   6735
  147.          Width           =   1380
  148.       End
  149.    End
  150.    Begin CommandButton Command1 
  151.       BackColor       =   &H00C0C0C0&
  152.       Caption         =   "&Order Form"
  153.       Default         =   -1  'True
  154.       Height          =   870
  155.       Index           =   9
  156.       Left            =   240
  157.       TabIndex        =   13
  158.       Top             =   4440
  159.       Width           =   1905
  160.    End
  161.    Begin ComboBox cmbOrientation 
  162.       Enabled         =   0   'False
  163.       Height          =   300
  164.       Left            =   2880
  165.       Style           =   2  'Dropdown List
  166.       TabIndex        =   0
  167.       Top             =   105
  168.       Width           =   1065
  169.    End
  170.    Begin CommandButton cmdPrint 
  171.       BackColor       =   &H00C0C0C0&
  172.       Caption         =   "&Print"
  173.       Enabled         =   0   'False
  174.       Height          =   300
  175.       Left            =   6120
  176.       TabIndex        =   2
  177.       Top             =   120
  178.       Width           =   1095
  179.    End
  180.    Begin vsViewPort vsViewPort1 
  181.       BackColor       =   &H00808080&
  182.       ConvInfo        =   FEZPRINT.FRX:000B
  183.       Height          =   5490
  184.       Left            =   2295
  185.       Top             =   525
  186.       VirtualHeight   =   0
  187.       VirtualWidth    =   0
  188.       Width           =   4980
  189.       Begin vsPrinter vsPrinter 
  190.          BackColor       =   &H00FFFFFF&
  191.          BrushColor      =   &H0080FFFF&
  192.          ConvInfo        =   FEZPRINT.FRX:0016
  193.          FontName        =   "Arial"
  194.          FontSize        =   40
  195.          Footer          =   "||Page %d"
  196.          HdrColor        =   &H00800000&
  197.          HdrFontBold     =   -1  'True
  198.          HdrFontItalic   =   -1  'True
  199.          HdrFontName     =   "Arial"
  200.          HdrFontSize     =   24
  201.          Header          =   "|VideoSoft VSView"
  202.          Height          =   3555
  203.          Left            =   105
  204.          PenWidth        =   2
  205.          TableSep        =   "|;"
  206.          Top             =   105
  207.          Width           =   2805
  208.       End
  209.    End
  210.    Begin ComboBox cmbZoom 
  211.       Enabled         =   0   'False
  212.       Height          =   300
  213.       Left            =   4800
  214.       Style           =   2  'Dropdown List
  215.       TabIndex        =   1
  216.       Top             =   105
  217.       Width           =   960
  218.    End
  219.    Begin Image Image3 
  220.       Height          =   510
  221.       Left            =   960
  222.       Picture         =   FEZPRINT.FRX:0021
  223.       Stretch         =   -1  'True
  224.       Top             =   5520
  225.       Visible         =   0   'False
  226.       Width           =   750
  227.    End
  228.    Begin Image Image2 
  229.       Height          =   330
  230.       Left            =   285
  231.       Picture         =   FEZPRINT.FRX:937B
  232.       Stretch         =   -1  'True
  233.       Top             =   5640
  234.       Visible         =   0   'False
  235.       Width           =   540
  236.    End
  237.    Begin Label Label1 
  238.       Alignment       =   2  'Center
  239.       AutoSize        =   -1  'True
  240.       BackStyle       =   0  'Transparent
  241.       Caption         =   "Orient."
  242.       ForeColor       =   &H00000000&
  243.       Height          =   195
  244.       Index           =   2
  245.       Left            =   2250
  246.       TabIndex        =   15
  247.       Top             =   130
  248.       Width           =   615
  249.    End
  250.    Begin Label Label1 
  251.       Alignment       =   2  'Center
  252.       AutoSize        =   -1  'True
  253.       BackStyle       =   0  'Transparent
  254.       Caption         =   "Zoom"
  255.       ForeColor       =   &H00000000&
  256.       Height          =   195
  257.       Index           =   1
  258.       Left            =   4275
  259.       TabIndex        =   14
  260.       Top             =   135
  261.       Width           =   495
  262.    End
  263.    Begin Image Image1 
  264.       Height          =   420
  265.       Left            =   240
  266.       Picture         =   FEZPRINT.FRX:9F1D
  267.       Top             =   105
  268.       Width           =   420
  269.    End
  270. Option Explicit
  271. Dim MyPage%         'Keep the output view to be printed
  272. Dim OldOrientation  'Don't mess with my printer settings
  273. Sub cmbOrientation_Click ()
  274.   mousepointer = 11
  275.   vsPrinter.Orientation = cmbOrientation.ListIndex
  276.   cmbZoom_click
  277.   If MyPage >= 0 Then command1_click MyPage
  278.   mousepointer = 0
  279. End Sub
  280. Sub cmbZoom_click ()
  281.   vsPrinter.Visible = False
  282.   mousepointer = 11
  283.   'Change the screen size to zoom value
  284.   vsPrinter.Width = vsPrinter.PageWidth * Val(cmbZoom) / 100
  285.   vsPrinter.Height = vsPrinter.PageHeight * Val(cmbZoom) / 100
  286.   'Make scrollable ViewPort
  287.   vsViewPort1.VirtualWidth = vsPrinter.Width + 400
  288.   vsViewPort1.VirtualHeight = vsPrinter.Height + 400
  289.   ' center printer if it fit on the screen
  290.   If vsPrinter.Width < vsViewPort1.Width Then vsPrinter.Left = (vsViewPort1.Width - vsPrinter.Width) / 2
  291.   If vsPrinter.Height < vsViewPort1.Height Then vsPrinter.Top = (vsViewPort1.Height - vsPrinter.Height) / 2
  292.   mousepointer = 0
  293.   vsPrinter.Visible = True
  294. End Sub
  295. Sub cmdPrint_Click ()
  296.   ' get ready to print
  297.   cmdPrint.Enabled = False
  298.   mousepointer = 11
  299.   ' print to the printer
  300.   vsPrinter.Preview = False
  301.   command1_click MyPage
  302.   vsPrinter.Preview = True
  303.   ' all done
  304.   cmdPrint.Enabled = True
  305.   mousepointer = 0
  306. End Sub
  307. Sub command1_click (Index%)
  308.       
  309.   ' remember page for use with Print command
  310.   MyPage = Index%
  311.   ' we have a print job, so let's enable these guys
  312.   cmbZoom.Enabled = True
  313.   cmdPrint.Enabled = True
  314.   cmbOrientation.Enabled = True
  315.   ' start the print preview job
  316.   vsPrinter.Action = 3 ' StartDoc
  317.   If vsPrinter.Error Then Beep: Exit Sub
  318.   mousepointer = 11
  319.   SetDefaultStyle
  320.   ' choose what to print based on button index
  321.   Select Case Index
  322.     Case 0: DoLine
  323.     Case 1: DoParagraph
  324.     Case 2: DoTable
  325.     Case 3: DoColumns
  326.     Case 4: DoDrawing
  327.     Case 5: DoAlign
  328.     Case 6: DoIndent
  329.     Case 7: DoMailMerge "Joe Smith", "Chief Financial Officer"
  330.             DoMailMerge "Mary Kerney", "President"
  331.     Case 8: DoGraphics
  332.     Case 9: DoOrder
  333.     Case 10: DoAngle
  334.     Case 11: DoFancyTable
  335.     Case 12: ' print table of contents
  336.               vsPrinter = "Table of Contents"
  337.               vsPrinter.FontSize = 20
  338.               DoTableOfContents "Acknowledgements", "i"
  339.               DoTableOfContents "Introduction", "1"
  340.               DoTableOfContents "Background", "5"
  341.               DoTableOfContents "Printing", "15"
  342.               DoTableOfContents "  graphics", "25"
  343.               DoTableOfContents "  text", "46"
  344.               DoTableOfContents "Previewing", "67"
  345.               DoTableOfContents "  graphics", "88"
  346.               DoTableOfContents "  text", "92"
  347.               DoTableOfContents "Conclusion", "125"
  348.   End Select
  349.   ' all done
  350.   vsPrinter.Action = 6 'End Document
  351.   mousepointer = 0
  352. End Sub
  353. Sub DoAlign ()
  354.       
  355.       ' show page title
  356.       vsPrinter.SpaceAfter = 100
  357.       vsPrinter.TextColor = QBColor(1)
  358.       vsPrinter.TextAlign = 1  'Center
  359.       vsPrinter.FontUnderline = True
  360.       vsPrinter.Paragraph = ""
  361.       vsPrinter.Paragraph = "VSPrinter automatically aligns proportional fonts"
  362.       vsPrinter.FontUnderline = False
  363.       
  364.       ' show off
  365.       vsPrinter.Paragraph = ""
  366.       vsPrinter.FontSize = 20
  367.       vsPrinter.TextColor = QBColor(0)
  368.       vsPrinter.CurrentX = vsPrinter.MarginLeft
  369.       vsPrinter.TextAlign = 2  'Rigth
  370.       vsPrinter.Paragraph = "Text is right aligned"
  371.       vsPrinter.TextAlign = 1  'Center
  372.       vsPrinter.Paragraph = "Text is centered"
  373.       vsPrinter.TextAlign = 0  'Left
  374.       vsPrinter.Paragraph = "Text is left aligned"
  375.       vsPrinter.SpaceAfter = 0
  376. End Sub
  377. Sub DoAngle ()
  378.       Dim i%, j%
  379.       ' show page title
  380.       vsPrinter.TextAngle = 450
  381.       vsPrinter = ""
  382.       vsPrinter = ""
  383.       vsPrinter = ""
  384.       vsPrinter = ""
  385.       vsPrinter = "Rotate text"
  386.       vsPrinter = "to any angle"
  387.       
  388.       ' rotate Text
  389.       j = 1
  390.       For i = 450 To 3600 Step 900
  391.         vsPrinter.TextColor = QBColor(j)
  392.         vsPrinter.CurrentX = vsPrinter.PageWidth * .5
  393.         vsPrinter.CurrentY = vsPrinter.PageHeight * .5
  394.         vsPrinter.TextAngle = i
  395.         vsPrinter.Text = "VSView"
  396.         j = j + 1
  397.       Next
  398.       ' restore defaults
  399.       vsPrinter.TextAngle = 0
  400.       vsPrinter.TextColor = 0
  401. End Sub
  402. Sub DoColumns ()
  403.       Dim s$, i%
  404.       ' set multi-column mode
  405.       vsPrinter.Columns = 2
  406.       
  407.       ' create a string to print
  408.       s = "VSPrinter can also print in multiple columns. "
  409.       s = s + "You have control over column breaks, and you can save "
  410.       s = s + "a whole lot of paper by using multiple columns."
  411.       
  412.       ' print text in two colors just for fun
  413.       vsPrinter.TextColor = QBColor(1)
  414.       vsPrinter = s
  415.       vsPrinter = ""
  416.       vsPrinter.TextColor = QBColor(0)
  417.       vsPrinter = s
  418. End Sub
  419. Sub DoDrawing ()
  420.       Dim s$, X%, Y%
  421.       ' go to center of the page
  422.       vsPrinter.CurrentX = vsPrinter.PageWidth / 2
  423.       vsPrinter.CurrentY = vsPrinter.PageHeight / 2
  424.       ' start with some text
  425.       vsPrinter.TextAlign = 1
  426.       vsPrinter.TextColor = &H800000       'Blue
  427.       vsPrinter = "Add graphics to your reports!"
  428.       vsPrinter.TextColor = &H0&           'Black
  429.       vsPrinter = "With VSPrinter, it's easy!"
  430.       vsPrinter.TextAlign = 0              ' Left
  431.       ' draw graphics with primitives
  432.       vsPrinter.X1 = vsPrinter.PageWidth / 4 * .25
  433.       vsPrinter.Y1 = vsPrinter.PageHeight / 4 * .25
  434.       vsPrinter.X2 = vsPrinter.PageWidth / 4 * 1.25
  435.       vsPrinter.Y2 = vsPrinter.PageHeight / 4 * 1.25
  436.       vsPrinter.BrushColor = &HFF&         'Red
  437.       vsPrinter.BrushStyle = 6             'Cross
  438.       vsPrinter.Draw = 3                   'Circle
  439.       vsPrinter.X1 = vsPrinter.PageWidth * .7
  440.       vsPrinter.Y1 = vsPrinter.PageHeight * .7
  441.       vsPrinter.X2 = vsPrinter.PageWidth * .9
  442.       vsPrinter.Y2 = vsPrinter.PageHeight * .9
  443.       vsPrinter.BrushColor = &H800080      'Purple
  444.       vsPrinter.BrushStyle = 7             'Cross Diagonal
  445.       vsPrinter.Draw = 2                   'Rect.
  446.       ' polylines are good for charts, graphs, maps etvsPrinter...
  447.       s = ""
  448.       For X = vsPrinter.MarginLeft To vsPrinter.PageWidth - vsPrinter.MarginRight Step 20
  449.         Y = 3000 + Cos(X * 3.1416 / 180) * (X - vsPrinter.PageWidth / 2) / 10
  450.         s = s + Str(X) + Str(Y)
  451.       Next
  452.       vsPrinter.PenWidth = 30
  453.       vsPrinter.PolyLine = s
  454.       vsPrinter.PenWidth = 0
  455. End Sub
  456. Sub DoFancyTable ()
  457.     Dim f$, s$, tw, savx
  458.     Dim sp%
  459.     ' initialize
  460.     f = "2000|1800|^1440|^2200;"
  461.     tw = 2000 + 1800 + 1440 + 2200
  462.     s = "Country|Capital|GNP|Comments"
  463.     ' print page title
  464.     vsPrinter.TextAlign = 1    'Center
  465.     vsPrinter.FontSize = 40
  466.     vsPrinter = ""
  467.     vsPrinter = "Shading Tables"
  468.     vsPrinter.FontSize = 18
  469.     vsPrinter = ""
  470.     vsPrinter = ""
  471.     ' save row start position
  472.     Select Case vsPrinter.TextAlign
  473.       Case 0: vsPrinter.X1 = vsPrinter.CurrentX
  474.       Case 1: vsPrinter.X1 = (vsPrinter.PageWidth - tw) / 2
  475.       Case 2: vsPrinter.X1 = vsPrinter.PageWidth - tw - vsPrinter.MarginRight
  476.     End Select
  477.     savx = vsPrinter.X1
  478.     vsPrinter.Y1 = vsPrinter.CurrentY
  479.     ' print header just to measure row
  480.     vsPrinter.FontBold = True
  481.     vsPrinter.Table = f + s
  482.     ' save row end position
  483.     vsPrinter.X2 = vsPrinter.X1 + tw
  484.     vsPrinter.Y2 = vsPrinter.CurrentY
  485.     ' use saved positions to draw light shading
  486.     vsPrinter.BrushStyle = 0
  487.     vsPrinter.BrushColor = RGB(255, 255, 0)
  488.     vsPrinter.PenColor = vsPrinter.BrushColor
  489.     vsPrinter.Draw = 2 ' rectangle
  490.     vsPrinter.PenColor = 0
  491.       
  492.       
  493.     ' the shading erased the row, so let's go again
  494.     vsPrinter.CurrentX = savx
  495.     vsPrinter.CurrentY = vsPrinter.Y1
  496.     vsPrinter.Table = f + s
  497.       
  498.     ' disable header coloring
  499.     vsPrinter.TextColor = 0
  500.     sp = MyPage
  501.     MyPage = -1
  502.     ' do the table body
  503.     vsPrinter.FontBold = False
  504.     s = f + "Argentina|Buenos Aires|50|Tango land;"
  505.     s = s + "Brazil|Brasilia|150|Lambada, anyone?;"
  506.     s = s + "Chile|Santiago|25|This has nothing to do with beans!;"
  507.     vsPrinter.Table = s
  508.     '  let's try some pictures on the table
  509.     vsPrinter.FontSize = 40
  510.     vsPrinter = ""
  511.     vsPrinter = "Pictures on Tables"
  512.     vsPrinter.FontSize = 14
  513.     vsPrinter = ""
  514.     vsPrinter = ""
  515.     ' initialize
  516.     f = "2000|>720|7000;"
  517.     tw = 2000 + 720 + 7000
  518.     s = "Control||Comments;"
  519.     vsPrinter.TextAlign = 0    'Left
  520.     vsPrinter.X1 = vsPrinter.CurrentX
  521.     vsPrinter.Y1 = vsPrinter.CurrentY
  522.     ' print header just to measure row
  523.     vsPrinter.FontBold = True
  524.     vsPrinter.Table = f + s
  525.     ' save row end position
  526.     vsPrinter.X2 = vsPrinter.X1 + tw
  527.     vsPrinter.Y2 = vsPrinter.CurrentY
  528.     ' just for kicks, put a picture in cell 2
  529.     vsPrinter.X1 = vsPrinter.X1 + 2000
  530.     vsPrinter.X2 = vsPrinter.X1 + 720
  531.     vsPrinter.Picture = image1
  532.     s = "Grid|No|Limited functionality;"
  533.     s = s + "vsPrinter|Yes|Very powerful"
  534.     vsPrinter.Table = f + s
  535.     ' restore defaults
  536.     MyPage = sp
  537. End Sub
  538. Sub DoGraphics ()
  539.     Dim s$, fmt$
  540.     ' print page title
  541.     vsPrinter = ""
  542.     vsPrinter.CurrentX = 2500
  543.     vsPrinter.TextColor = QBColor(1)
  544.     vsPrinter = "Metafiles and Bitmaps"
  545.     vsPrinter.TextColor = QBColor(0)
  546.     vsPrinter.FontSize = 28
  547.     vsPrinter = ""
  548.     s = "You can now print and preview reports that "
  549.     s = s + "include bitmaps and metafiles.  "
  550.     s = s + "Automate desktop publishing with vsView!!!!"
  551.     vsPrinter = s
  552.     vsPrinter = ""
  553.     ' print pictures, stretch and align anywhere on the page
  554.     vsPrinter.X1 = 1000
  555.     vsPrinter.Y1 = 1000
  556.     vsPrinter.X2 = 2400
  557.     vsPrinter.Y2 = 2400
  558.     vsPrinter.Picture = image3.Picture
  559.     vsPrinter.X1 = vsPrinter.CurrentX
  560.     vsPrinter.Y1 = vsPrinter.CurrentY
  561.     vsPrinter.X2 = vsPrinter.PageWidth - vsPrinter.MarginRight
  562.     vsPrinter.Y2 = vsPrinter.PageHeight - vsPrinter.MarginBottom
  563.     vsPrinter.Picture = image3.Picture
  564.       
  565. End Sub
  566. Sub DoIndent ()
  567.     ' indent left, right, or center
  568.     vsPrinter.IndentFirst = 1000
  569.     vsPrinter = "You can automatically indent the FIRST LINE of a paragraph."
  570.     vsPrinter = ""
  571.     vsPrinter.IndentFirst = 0
  572.     vsPrinter.IndentLeft = 1000
  573.     vsPrinter = "You can automatically indent from the LEFT margin of the page."
  574.     vsPrinter = ""
  575.     vsPrinter.IndentLeft = 0
  576.     vsPrinter.IndentRight = 1000
  577.     vsPrinter = "You can automatically indent from the RIGHT margin of the page."
  578.     vsPrinter = ""
  579.     vsPrinter.IndentLeft = 1000
  580.     vsPrinter.IndentFirst = 1500
  581.     vsPrinter = "Or combine all types of indentation."
  582.     ' restore defaults
  583.     vsPrinter.IndentLeft = 0
  584.     vsPrinter.IndentFirst = 0
  585.     vsPrinter.IndentRight = 0
  586. End Sub
  587. Sub DoLine ()
  588.       
  589.       ' start a line or paragraph with one font
  590.       vsPrinter.TextColor = 0
  591.       vsPrinter = ""
  592.       vsPrinter.Text = "With VSPrinter you can print "
  593.       ' continue with a different font
  594.       vsPrinter.FontBold = True
  595.       vsPrinter.TextColor = RGB(255, 0, 255)
  596.       vsPrinter.Text = "Line by Line"
  597.       
  598.       ' and finish with the original font!
  599.       vsPrinter.TextColor = 0
  600.       vsPrinter.FontBold = False
  601.       vsPrinter.Text = " just like you would in VB."
  602.       vsPrinter.Text = " Text wraps automatically, so your life becomes easier."
  603. End Sub
  604. Sub DoMailMerge (FullName$, Position$)
  605.     ' get ready to print with "corporate" font
  606.     vsPrinter.FontBold = False
  607.     vsPrinter.FontSize = 24
  608.     vsPrinter.TextColor = 0
  609.     ' you could print a letterhead here...
  610.     ' date and salutation...
  611.     vsPrinter = Format$(Now, "mmmm d, yyyy")
  612.     vsPrinter = ""
  613.     vsPrinter = ""
  614.     vsPrinter.Text = "This letter is to inform that "
  615.     ' print person name and new position
  616.     vsPrinter.TextColor = RGB(255, 0, 0)
  617.     vsPrinter.Text = FullName
  618.     vsPrinter.TextColor = 0
  619.     vsPrinter.Text = " has been promoted to "
  620.     vsPrinter.TextColor = RGB(255, 0, 0)
  621.     vsPrinter.Text = Position
  622.     vsPrinter.TextColor = 0
  623.     vsPrinter.Text = " of this company."
  624.     ' skip an inch instead of breaking pages (with Action property)
  625.     vsPrinter.CurrentY = vsPrinter.CurrentY + 1440
  626.     vsPrinter.CurrentX = vsPrinter.MarginLeft
  627. End Sub
  628. Sub DoOrder ()
  629.     Dim fmt$, s$, INCHES%
  630.     ' initialize
  631.     INCHES = 1440
  632.     vsPrinter.FontSize = 30
  633.     vsPrinter.FontBold = True
  634.     ' place money picture
  635.     vsPrinter.X1 = vsPrinter.PageWidth - (2.5 * INCHES)
  636.     vsPrinter.Y1 = .75 * INCHES
  637.     vsPrinter.X2 = vsPrinter.X1 + (2 * INCHES)
  638.     vsPrinter.Y2 = vsPrinter.Y1 + (1.25 * INCHES)
  639.     vsPrinter.Picture = image2.Picture
  640.     ' print title
  641.     vsPrinter.CurrentY = .75 * INCHES
  642.     vsPrinter = "ORDER FORM"
  643.     vsPrinter.PenWidth = 2
  644.     vsPrinter.FontSize = 10
  645.     vsPrinter.FontBold = False
  646.     vsPrinter = "Please rush my order to the following address:"
  647.     vsPrinter = ""
  648.     ' print table to hold customer name and address
  649.     fmt = "2500|>4500;" ' column widths in Twips (1440 = 1 inch)
  650.     s = fmt
  651.     s = s + "Name|;"
  652.     s = s + "Company|;"
  653.     s = s + "Address|;"
  654.     s = s + "|;"
  655.     s = s + "|;"
  656.     s = s + "|;"
  657.     s = s + "Phone|;"
  658.     s = s + "Fax|;"
  659.     s = s + "Credit Card #|;"
  660.     s = s + "Expiration Date|;"
  661.     s = s + "Comments|;"
  662.     s = s + "|;"
  663.     s = s + "|;"
  664.     vsPrinter.TableBorder = 5 ' columns
  665.     vsPrinter.Table = s
  666.     ' some fine print...
  667.     vsPrinter = ""
  668.     vsPrinter = ""
  669.     vsPrinter = "Fax your credit card order to 510-547-1084 or mail your check or money order to: VideoSoft, 2625 Alcatraz Avenue, Suite 271, Berkeley, California 94705.  Sorry no CODs."
  670.     vsPrinter = ""
  671.     ' another table for quantities and amounts (let's center this one)
  672.     vsPrinter.TextAlign = 1   ' center
  673.     vsPrinter.TableBorder = 7 ' all
  674.     fmt = "^2000|^4000|^2000|^2000;"
  675.     s = fmt
  676.     s = s + "QUANTITY|COPIES OF|PRICE|TOTAL;"
  677.     vsPrinter.Table = s
  678.     ' print body in 4 columns but with different column alignment
  679.     fmt = "^2000|4000|>2000|>2000;"
  680.     s = fmt
  681.     s = s + "|VideoSoft VSView|$99.00|;"
  682.     s = s + "|VideoSoft VSVBX|$45.00|;"
  683.     s = s + "|VideoSoft CodeBook|$45.00|;"
  684.     vsPrinter.Table = s
  685.     ' now append another table with only 2 columns
  686.     fmt = ">8000|>2000;"
  687.     s = fmt
  688.     s = s + "California state residents add 8.5% sales tax|;"
  689.     s = s + "Shipping and Handling Domestic|US$6.00;"
  690.     s = s + "Shipping and Handling International|US$10.00;"
  691.     s = s + "TOTAL|;"
  692.     vsPrinter.Table = s
  693. End Sub
  694. Sub DoParagraph ()
  695.     Dim s$
  696.     ' print paragraphs by assigning a string to the printer
  697.     s = "You can print whole paragraphs at once! This is very easy. "
  698.     vsPrinter.Paragraph = s + s
  699.     vsPrinter.Paragraph = ""
  700.     vsPrinter.Paragraph = "VSPrinter takes care of indentation, wrapping, spacing, etvsPrinter."
  701. End Sub
  702. Sub DoTable ()
  703.     Dim s$, fmt$
  704.     ' print page title
  705.     vsPrinter = "Print by Table"
  706.     vsPrinter.FontSize = 18
  707.     vsPrinter = ""
  708.     s = "You can now print reports that include paragraphs "
  709.     s = s + "and tables.  With VSView, printing a grid it is very easy."
  710.     vsPrinter = s
  711.     vsPrinter = ""
  712.     ' create table format
  713.     fmt = "2500|>1600|^1600|>2100|>2200;"                   '^Center > Right
  714.     ' create table string
  715.     s = fmt + "Product|Code|Region|Units Sold|Revenue;"     'Set header
  716.     s = s + "Spam in a Can|00012|North|372|$23,542;"
  717.     s = s + "Flipper Tuna|00231|North|832|$44,432;"
  718.     s = s + "Jiffy Lubed Butter|00978|North|452|$53,535"
  719.     ' print the table in three flavors
  720.     vsPrinter.PenWidth = 1
  721.     vsPrinter.TextAlign = 1
  722.     vsPrinter.FontSize = 18
  723.     vsPrinter.TableBorder = 7
  724.     vsPrinter.Table = s         ' flavor 1
  725.     vsPrinter = ""
  726.     vsPrinter.FontSize = 14
  727.     vsPrinter.TableBorder = 8
  728.     vsPrinter.Table = s         ' flavor 2
  729.     vsPrinter = ""
  730.     vsPrinter = ""
  731.     vsPrinter.TableBorder = 9
  732.     vsPrinter.Table = s         ' flavor 3
  733.     ' and resume printing regular text
  734.     vsPrinter = "Same table, different alignment and borders."
  735. End Sub
  736. Sub DoTableOfContents (txt$, pp$)
  737.     Dim pw, ppos
  738.     ' measure width of page number string
  739.     vsPrinter.Measure = pp
  740.     pw = vsPrinter.TextWid
  741.     ' print topic name
  742.     vsPrinter.TextAlign = 0
  743.     vsPrinter.Text = txt
  744.     ' print dot string
  745.     ppos = vsPrinter.PageWidth - vsPrinter.MarginRight - pw
  746.     Do
  747.       vsPrinter.Text = " ."
  748.     Loop While vsPrinter.CurrentX < ppos - 1440 / 4
  749.     ' print page number and skip to next line
  750.     vsPrinter.TextAlign = 2
  751.     vsPrinter.Text = pp
  752.     vsPrinter.TextAlign = 0
  753.     vsPrinter = ""
  754. End Sub
  755. Sub Form_Load ()
  756.   ' save orientation to clean up later
  757.   OldOrientation = vsPrinter.Orientation
  758.   ' initialize
  759.   MyPage = -1    ' no current page
  760.   vsPrinter.Preview = True
  761.   vsPrinter.PreviewPage = 1
  762.   ' preset zoom levels (you can choose your own)
  763.   cmbZoom.AddItem "35"
  764.   cmbZoom.AddItem "50"
  765.   cmbZoom.AddItem "75"
  766.   cmbZoom.AddItem "100"
  767.   cmbZoom.AddItem "150"
  768.   cmbZoom.AddItem "200"
  769.   cmbZoom.ListIndex = 0
  770.   ' orientation (you cannot choose your own)
  771.   cmbOrientation.AddItem "Portrait"
  772.   cmbOrientation.AddItem "Landscape"
  773.   cmbOrientation.ListIndex = 0
  774.   ' ready, set default page to 0
  775.   MyPage = 0
  776. End Sub
  777. Sub Form_Unload (Cancel As Integer)
  778.   ' restore printer orientation
  779.   vsPrinter.Orientation = OldOrientation
  780. End Sub
  781. Sub SetDefaultStyle ()
  782.   'Default Printing Values
  783.   vsPrinter.FontName = "Arial"
  784.   vsPrinter.FontSize = 40
  785.   vsPrinter.FontBold = False
  786.   vsPrinter.FontItalic = False
  787.   vsPrinter.TextAlign = 0  'Left
  788.   vsPrinter.TableBorder = 7
  789.   vsPrinter.PageBorder = 3
  790.   vsPrinter.PenStyle = 0
  791.   vsPrinter.BrushStyle = 0
  792.   vsPrinter.PenWidth = 2
  793.   vsPrinter.PenColor = 0
  794.   vsPrinter.BrushColor = 0
  795.   vsPrinter.TextColor = 0
  796.   vsPrinter.Columns = 1
  797.   vsPrinter.SpaceAfter = 0
  798. End Sub
  799. Sub vsPrinter_Error ()
  800. End Sub
  801. Sub vsPrinter_NewTableCell (row As Integer, Column As Integer, Cell As String)
  802.   ' only when printing Table Example
  803.   If MyPage <> 2 Then Exit Sub
  804.   ' change color of hte headers (row 1)
  805.   If row = 1 Then
  806.     vsPrinter.TextColor = QBColor(Column)
  807.   Else
  808.     vsPrinter.TextColor = 1
  809.   End If
  810. End Sub
  811.