home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / WIN / Programa / VPE16_14.ZIP / VB / FORMMAIN.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1996-06-03  |  30.4 KB  |  719 lines

  1. VERSION 4.00
  2. Begin VB.Form FormMain 
  3.    Caption         =   "VPE Demo"
  4.    ClientHeight    =   3495
  5.    ClientLeft      =   990
  6.    ClientTop       =   1755
  7.    ClientWidth     =   4860
  8.    Height          =   3900
  9.    Left            =   930
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3495
  12.    ScaleWidth      =   4860
  13.    Top             =   1410
  14.    Width           =   4980
  15.    Begin VB.CommandButton PageRight 
  16.       Caption         =   ">>"
  17.       Height          =   255
  18.       Left            =   2520
  19.       TabIndex        =   10
  20.       Top             =   840
  21.       Width           =   495
  22.    End
  23.    Begin VB.CommandButton PageLeft 
  24.       Caption         =   "<<"
  25.       Height          =   255
  26.       Left            =   1800
  27.       TabIndex        =   9
  28.       Top             =   840
  29.       Width           =   495
  30.    End
  31.    Begin VB.CommandButton DelReport 
  32.       Caption         =   "Delete Report"
  33.       Height          =   255
  34.       Left            =   120
  35.       TabIndex        =   8
  36.       Top             =   1560
  37.       Width           =   1215
  38.    End
  39.    Begin VB.CommandButton GenReport 
  40.       Caption         =   "Generate Report"
  41.       Height          =   255
  42.       Left            =   120
  43.       TabIndex        =   7
  44.       Top             =   1200
  45.       Width           =   1215
  46.    End
  47.    Begin VB.CommandButton SpeedClose 
  48.       Caption         =   "Close"
  49.       Height          =   375
  50.       Left            =   3720
  51.       TabIndex        =   6
  52.       Top             =   1200
  53.       Width           =   975
  54.    End
  55.    Begin VB.CommandButton PrecisionClose 
  56.       Caption         =   "Close"
  57.       Height          =   375
  58.       Left            =   3720
  59.       TabIndex        =   5
  60.       Top             =   240
  61.       Width           =   975
  62.    End
  63.    Begin VB.TextBox MsgText 
  64.       BackColor       =   &H00C0C0C0&
  65.       Enabled         =   0   'False
  66.       Height          =   615
  67.       Left            =   120
  68.       MultiLine       =   -1  'True
  69.       TabIndex        =   4
  70.       Top             =   2760
  71.       Width           =   4695
  72.    End
  73.    Begin VB.CommandButton Background 
  74.       Caption         =   "Background"
  75.       Height          =   375
  76.       Left            =   120
  77.       TabIndex        =   3
  78.       Top             =   240
  79.       Width           =   1095
  80.    End
  81.    Begin VB.CommandButton Exit 
  82.       Caption         =   "Exit"
  83.       Height          =   495
  84.       Left            =   1800
  85.       TabIndex        =   2
  86.       Top             =   2040
  87.       Width           =   1095
  88.    End
  89.    Begin VB.CommandButton Speed 
  90.       Caption         =   "Speed + Tables"
  91.       Height          =   495
  92.       Left            =   1440
  93.       TabIndex        =   1
  94.       Top             =   1200
  95.       Width           =   1935
  96.    End
  97.    Begin VB.CommandButton Precision 
  98.       Caption         =   "Capabilities + Precision"
  99.       Height          =   495
  100.       Left            =   1440
  101.       TabIndex        =   0
  102.       Top             =   240
  103.       Width           =   1935
  104.    End
  105. Attribute VB_Name = "FormMain"
  106. Attribute VB_Creatable = False
  107. Attribute VB_Exposed = False
  108. Rem ordinal for storing a setting
  109. Const HEADLINE = 1
  110. Dim hPrecision As Long
  111. Dim hSpeed As Long
  112. Dim rc As Rect
  113. Dim sum_amount, sum_prorated, sum_tax As Double
  114. Private Sub DelReport_Click()
  115.    If Dir("journal.rpt") = "" Then
  116.       Exit Sub
  117.    End If
  118.    Kill "journal.rpt"
  119. End Sub
  120. Private Sub Exit_Click()
  121.    Call ClosePrecision
  122.    Call CloseSpeed
  123.    If hPrecision = 0 And hSpeed = 0 Then
  124.       End
  125.    End If
  126. End Sub
  127. Private Sub Form_Load()
  128.    Call InitVPE
  129.    hPrecision = 0
  130.    hSpeed = 0
  131. End Sub
  132. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  133.    Call ClosePrecision
  134.    Call CloseSpeed
  135.    If hPrecision <> 0 Or hSpeed <> 0 Then
  136.       Cancel = 1
  137.    End If
  138. End Sub
  139. Private Sub GenReport_Click()
  140.    MsgText = "Generating pseudo report-file..."
  141.    MsgText.Refresh
  142.    Dim i, stepper, min, z As Integer
  143.    Dim count, table As Long
  144.    count = 0
  145.    table = 1
  146.    Randomize
  147.    Open "journal.rpt" For Output As 1
  148.    Print #1, "Test-Document"
  149.    Print #1, "1996" + vbCrLf
  150.    z = 0
  151.    While count < 20000
  152.       If z < Rnd * 5 + 10 Then
  153.          stepper = 4
  154.          min = 3
  155.       Else
  156.          stepper = 21
  157.          min = 20
  158.          z = -1
  159.       End If
  160.       
  161.       z = z + 1
  162.       Print #1, "@Table " + Str(table)
  163.       table = table + 1
  164.       For i = Rnd * stepper + min To 0 Step -1
  165.          Print #1, count
  166.          Print #1, Format(Rnd * 28 + 1, "##00"); "."; Format(Rnd Mod 12 + 1, "##00"); ".96"
  167.          Print #1, Format(Rnd * 99999, "##,###.00")
  168.          Print #1, Format(Rnd * 99999, "##,###.00")
  169.          Print #1, Format(Rnd * 99999, "##,###.00")
  170.          Print #1, vbCrLf
  171.          count = count + 7
  172.       Next
  173.    Wend
  174.    Close #1
  175.    MsgText = "Report generation finished."
  176. End Sub
  177. Private Sub Pageleft_Click()
  178.    If hPrecision Then
  179.       Call VpeSetUpdate(hPrecision, True)
  180.       Call VpeGotoPage(hPrecision, VpeGetCurrentPage(hPrecision) - 1)
  181.       Call VpeSetUpdate(hPrecision, False)
  182.    End If
  183. End Sub
  184. Private Sub PageRight_Click()
  185.    If hPrecision Then
  186.       Call VpeSetUpdate(hPrecision, True)
  187.       Call VpeGotoPage(hPrecision, VpeGetCurrentPage(hPrecision) + 1)
  188.       Call VpeSetUpdate(hPrecision, False)
  189.    End If
  190. End Sub
  191. Private Sub Precision_Click()
  192.    If hPrecision Then
  193.       Exit Sub
  194.    End If
  195.    MsgText = "This window shows the capabilities of VPE, the Virtual Print Engine"
  196.    MsgText.Refresh
  197.    Call PrecisionProc(0)
  198. End Sub
  199. Private Sub PrecisionClose_Click()
  200.    Call ClosePrecision
  201. End Sub
  202. Private Sub Page1(ByVal hDoc As Long)
  203.    Dim DemoText As String
  204.    Dim y As Long
  205.    DemoText = "The moment of impact bursts through the silence and in a roar of sound, the final second is prolonged in a world of echoes as if concrete and clay of Broadway itself was reliving its memories."
  206.    DemoText = DemoText + Chr$(10) + "The last great march past. Newsman stands limp as a whimper as audience and eventare locked as one. Bing Crosby coos'You don't have to feel pain to sing the blues, you don't have to holla - you don't feel a thing in your dollar collar.' Martin Luther cries 'Everybody Sing!' and rings the grand old liberty bell. Leary, weary of his prison cell, walks on heaven, talks on hell."
  207.    DemoText = DemoText + Chr$(10) + "Who needs Medicare and the 35c flat rate fare, when Fred Astaire and Ginger Rogers are dancing through the air? From Broadway Melody stereotypes the band returns to 'Stars and Stripes' bringing a tear to the moonshiner, who's been pouring out his spirit from the illegal still. The pawn broker clears the noisy till and clutches his lucky dollar bill."
  208.    DemoText = DemoText + Chr$(10) + "Then the blackout." + Chr$(10) + Chr$(10) + "(Genesis, 'The Lamb lies down on Broadway')"
  209.    y = VpeWriteBox(hDoc, 575, 200, 1625, -1, "[Center PenSize 3]This demo shows the capabilities and precision of VPE." + Chr$(10) + "Print this page and compare not only the positions of the frames," + Chr$(10) + "but the positions of each letter that can be seen." + Chr$(10) + "(Switch the grid on.)" + Chr$(10) + "This is true WYSIWYG !!!" + Chr$(10) + "('What you see is what you get')" + Chr$(10) + "Note, that the nearest result can be seen at a scaling of 1:1." + Chr$(10) + "With every other scaling you get 'best results' in comparison to execution speed.")
  210.    y = VpeWriteBox(hDoc, 100, y + 75, 2000, -1, "['Arial' FontSize 14 Left Bold Italic Underline PenSize 0]RIGHT ALIGNED, 0.25 cm blue frame, light-blue backgr., red bold text, Arial 9pt")
  211.    Call VpeStoreSet(hDoc, HEADLINE)
  212.    Call VpeSelectFont(hDoc, "Arial", 9)
  213.    Call VpeSetPen(hDoc, 25, PS_SOLID, COLOR_BLUE)
  214.    Call VpeSetTextColor(hDoc, COLOR_LTRED)
  215.    Call VpeSetFontAttr(hDoc, ALIGN_RIGHT, 1, 0, 0)
  216.    Call VpeSetTransparentMode(hDoc, 0)
  217.    Call VpeSetBkgColor(hDoc, COLOR_CYAN)
  218.    Rem y+30 because frame = 0.25cm --> frame drawn around center of coordinates
  219.    Rem we also want a little gap between the headline and the frame
  220.    y = VpeWriteBox(hDoc, 150, y + 30, 1850, -1, DemoText)
  221.    Call VpeSetTransparentMode(hDoc, 1)
  222.    Call VpeUseSet(hDoc, HEADLINE)
  223.    y = VpeWrite(hDoc, 250, y + 75, 2000, -1, "JUSTIFIED, no frame, Times New Roman 11pt")
  224.    Call VpeSelectFont(hDoc, "Times New Roman", 11)
  225.    Call VpeSetFontAttr(hDoc, ALIGN_JUSTIFIED, 0, 0, 0)
  226.    y = VpeWriteBox(hDoc, 250, y + 20, 1550, -1, DemoText)
  227.    Call VpeUseSet(hDoc, HEADLINE)
  228.    y = VpeWriteBox(hDoc, 250, y + 75, 2000, -1, "CENTERED, thin yellow frame, Times New Roman 11pt")
  229.    Call VpeSelectFont(hDoc, "Times New Roman", 11)
  230.    Call VpeSetFontAttr(hDoc, ALIGN_CENTER, 0, 0, 0)
  231.    Call VpeSetPen(hDoc, 5, PS_SOLID, COLOR_LTYELLOW)
  232.    y = VpeWriteBox(hDoc, 150, y + 20, 1850, -1, DemoText)
  233. End Sub
  234. Public Sub PrecisionProc(ByVal mode As Integer)
  235.    Dim hDoc As Long
  236.    If mode = 0 Then
  237.       hDoc = VpeOpenDoc(hWnd, "Capabilities + Precision", -1, -1, VPE_NO_USER_CLOSE + VPE_GRID_POSSIBLE)
  238.       hPrecision = hDoc
  239.    Else
  240.       hDoc = VpeOpenDoc(hWnd, "Precision + Capabilities", -1, -1, 0)
  241.    End If
  242.    Call VpeSetAutoBreak(hDoc, AUTO_BREAK_NO_LIMITS)
  243.    Call VpeSetFontAttr(hDoc, ALIGN_LEFT, 0, 1, 1)
  244.    Call VpeSetPen(hDoc, 0, PS_SOLID, 0)
  245.    Call VpeDefineHeader(hDoc, 100, 100, 1000, 150, "Precision + Capabilities   /  IDEAL Software")
  246.    Call VpeSetUnderlined(hDoc, 0)
  247.    Call VpeDefineFooter(hDoc, 1900, 2800, 2100, 2900, "Page @PAGE")
  248.    Page1 (hDoc)
  249.    Page2 (hDoc)
  250.    Page3_4 (hDoc)
  251.    Page5 (hDoc)
  252.    Page6 (hDoc)
  253.    Call VpeRemoveSet(hDoc, HEADLINE)
  254.    Call VpeGotoPage(hDoc, 1)
  255.    If mode = 0 Then
  256.       rc.Right = -1
  257.       Call VpePreviewDoc(hPrecision, rc, VPE_SHOW_NORMAL)
  258.    Else
  259.       Call VpePrintDoc(hDoc, False)
  260.       Call VpeCloseDoc(hDoc)
  261.    End If
  262. End Sub
  263. Private Sub Page2(ByVal hDoc As Long)
  264.    Dim y, index, skip, first, xx, oldy, segments As Integer
  265.    Dim p As Long
  266.    Dim xr, xstep, yr, x As Double
  267.    Dim s As String
  268.    Call VpePageBreak(hDoc)
  269.    Call VpeUseSet(hDoc, HEADLINE)
  270.    y = VpeWriteBox(hDoc, 200, 200, 2000, -1, "An example of drawing (better to turn the grid off here):")
  271.    Call VpeSetPen(hDoc, 8, PS_SOLID, COLOR_BLACK)
  272.    Call VpeBox(hDoc, 200, 300, 1700, 1800)
  273.         
  274.    xr = 6
  275.    xstep = xr / 750
  276.    yr = 18
  277.    segments = 1
  278.    Rem The following graphs are created with VpeAddPolyPoint()
  279.    x = -xr
  280.    skip = 0
  281.    Call VpeSetPen(hDoc, 2, PS_SOLID, COLOR_BLUE)
  282.    p = VpePolyLine(hDoc, 0, 1500)
  283.    For xx = 200 To 1699
  284.       y = 1050 - (x ^ 3 - 2 * x ^ 2 - 8 * x) / (yr / 750)
  285.       x = x + xstep
  286.       
  287.       If y < 300 Then
  288.          y = 300
  289.          skip = 1
  290.       ElseIf y > 1800 Then
  291.          y = 1800
  292.          skip = 1
  293.       ElseIf skip = 1 Then
  294.          Call VpeAddPolyPoint(hDoc, p, -1, -1)
  295.          oldy = y
  296.          skip = 2
  297.       Else
  298.          If skip = 2 Then
  299.             Call VpeAddPolyPoint(hDoc, p, xx - 1, oldy)
  300.             skip = 0
  301.          End If
  302.          Call VpeAddPolyPoint(hDoc, p, xx, y)
  303.          segments = segments + 1
  304.       End If
  305.    Next
  306.    x = -xr
  307.    skip = 0
  308.    Call VpeSetPen(hDoc, 2, PS_SOLID, COLOR_LTRED)
  309.    p = VpePolyLine(hDoc, 0, 1500)
  310.    For xx = 200 To 1699
  311.       y = 1050 - (3 * x ^ 2 - 4 * x - 8) / (yr / 750)
  312.       x = x + xstep
  313.       
  314.       If y < 300 Then
  315.          y = 300
  316.          skip = 1
  317.       ElseIf y > 1800 Then
  318.          y = 1800
  319.          skip = 1
  320.       ElseIf skip = 1 Then
  321.          Call VpeAddPolyPoint(hDoc, p, -1, -1)
  322.          oldy = y
  323.          skip = 2
  324.       Else
  325.          If skip = 2 Then
  326.             Call VpeAddPolyPoint(hDoc, p, xx - 1, oldy)
  327.             skip = 0
  328.          End If
  329.          Call VpeAddPolyPoint(hDoc, p, xx, y)
  330.          segments = segments + 1
  331.       End If
  332.    Next
  333.    x = -xr
  334.    skip = 0
  335.    Call VpeSetPen(hDoc, 2, PS_SOLID, COLOR_GREEN)
  336.    p = VpePolyLine(hDoc, 0, 1500)
  337.    For xx = 200 To 1699
  338.       y = 1050 - (3 * x - 4) / (yr / 750)
  339.       x = x + xstep
  340.       
  341.       If y < 300 Then
  342.          y = 300
  343.          skip = 1
  344.       ElseIf y > 1800 Then
  345.          y = 1800
  346.          skip = 1
  347.       ElseIf skip = 1 Then
  348.          Call VpeAddPolyPoint(hDoc, p, -1, -1)
  349.          oldy = y
  350.          skip = 2
  351.       Else
  352.          If skip = 2 Then
  353.             Call VpeAddPolyPoint(hDoc, p, xx - 1, oldy)
  354.             skip = 0
  355.          End If
  356.          Call VpeAddPolyPoint(hDoc, p, xx, y)
  357.          segments = segments + 1
  358.       End If
  359.    Next
  360.    Call VpeSetPen(hDoc, 3, PS_SOLID, COLOR_BLACK)
  361.    Call VpeLine(hDoc, 200, 1050, 1700, 1050)
  362.    Call VpeLine(hDoc, 950, 300, 950, 1800)
  363.    Call VpeSelectFont(hDoc, "Arial", 10)
  364.    Call VpeSetFontAttr(hDoc, ALIGN_LEFT, 0, 0, 0)
  365.    Call VpeSetPen(hDoc, 1, PS_DOT, COLOR_BLACK)
  366.    xx = 1
  367.    Do While xx < xr
  368.       Call VpeLine(hDoc, 950 + xx * 750 / 6, 300, 950 + xx * 750 / 6, 1800)
  369.       Call VpePrint(hDoc, 960 + xx * 750 / 6, 1050, Str(xx))
  370.       Call VpeLine(hDoc, 950 - xx * 750 / 6, 300, 950 - xx * 750 / 6, 1800)
  371.       Call VpePrint(hDoc, 960 - xx * 750 / 6, 1050, Str(-xx))
  372.       xx = xx + 1
  373.    Loop
  374.    y = 2
  375.    Do While y < yr
  376.       Call VpeLine(hDoc, 200, 1050 + y * 750 / yr, 1700, 1050 + y * 750 / yr)
  377.       Call VpePrint(hDoc, 960, 1050 - y * 750 / yr, Str(y))
  378.       Call VpeLine(hDoc, 200, 1050 - y * 750 / yr, 1700, 1050 - y * 750 / yr)
  379.       Call VpePrint(hDoc, 960, 1050 + y * 750 / yr, Str(-y))
  380.       y = y + 2
  381.    Loop
  382.    y = 1850
  383.    Call VpeWrite(hDoc, 200, y, 2000, -1, "[S 14]The three graphs together consist of " + Str(segments) + " (number determined during runtime) single lines!" + Chr$(10) + Chr$(10) + "VPE manages this data bulk for you FAST!")
  384. End Sub
  385. Private Sub Page3_4(ByVal hDoc As Long)
  386.    Call VpePageBreak(hDoc)
  387.    Call VpeNoPen(hDoc)
  388.    Call VpeSetFontAttr(hDoc, ALIGN_CENTER, 0, 1, 0)
  389.    Call VpeSelectFont(hDoc, "Arial", 18)
  390.    Call VpeWrite(hDoc, 0, 150, 2100, 300, "The supported barcode-types:")
  391.    Call VpeSelectFont(hDoc, "Arial", 10)
  392.    Call VpeSetBold(hDoc, 1)
  393.    Call VpeWrite(hDoc, 200, 300, 550, 400, "2 of 5:")
  394.    Call VpeBarcode(hDoc, 200, 360, 550, 560, BCT_2OF5, "123789", vbNullString)
  395.    Call VpeWrite(hDoc, 700, 300, 1200, 400, "Interleaved 2 of 5:")
  396.    Call VpeBarcode(hDoc, 700, 360, 1200, 560, BCT_INTERLEAVED2OF5, "123895783482", vbNullString)
  397.    Call VpeWrite(hDoc, 1350, 300, 1750, 400, "Code 39 (text on top):")
  398.    Call VpeSetBarcodeParms(hDoc, 1, 0)
  399.    Call VpeBarcode(hDoc, 1350, 360, 1750, 560, BCT_CODE39, "ABC123", vbNullString)
  400.    Call VpeWrite(hDoc, 200, 700, 550, 800, "Code 93 (rotated):")
  401.    Call VpeSetRotation(hDoc, 900)
  402.    Call VpeBarcode(hDoc, 275, 760, -300, -200, BCT_CODE93, "DEF987", vbNullString)
  403.    Call VpeWrite(hDoc, 700, 700, 1200, 800, "[Rot 0]Codabar (rotated):")
  404.    Call VpeSetRotation(hDoc, 1800)
  405.    Call VpeBarcode(hDoc, 700, 760, -500, -200, BCT_CODABAR, "123456", vbNullString)
  406.    Call VpeWrite(hDoc, 1400, 700, 1700, 800, "[Rot 0]EAN-8 (rotated):")
  407.    Call VpeSetRotation(hDoc, 2700)
  408.    Call VpeBarcode(hDoc, 1450, 760, -300, -200, BCT_EAN8, "40167794", vbNullString)
  409.    Call VpeWrite(hDoc, 200, 1200, 500, 1400, "[Rot 0]EAN-8 + 2:")
  410.    Call VpeSetBarcodeParms(hDoc, 0, 1)
  411.    Call VpeBarcode(hDoc, 200, 1260, 500, 1460, BCT_EAN8_2, "12345670", "12")
  412.    Call VpeWrite(hDoc, 700, 1200, 1200, 1400, "EAN-8 + 5:")
  413.    Call VpeSetBarcodeParms(hDoc, 0, 0)
  414.    Call VpeBarcode(hDoc, 700, 1260, 1200, 1460, BCT_EAN8_5, "98765430", "12345")
  415.    Call VpeWrite(hDoc, 1350, 1200, 1750, 1400, "EAN-13:")
  416.    Call VpeBarcode(hDoc, 1350, 1260, 1750, 1460, BCT_EAN13, "9781556153952", vbNullString)
  417.    Call VpeWrite(hDoc, 200, 1600, 600, 1800, "EAN-13 + 2:")
  418.    Call VpeBarcode(hDoc, 200, 1660, 600, 1860, BCT_EAN13_2, "4501645096787", "12")
  419.    Call VpeWrite(hDoc, 700, 1600, 1200, 1800, "EAN-13 + 5:")
  420.    Call VpeSetBarcodeParms(hDoc, 0, 1)
  421.    Call VpeBarcode(hDoc, 700, 1660, 1200, 1860, BCT_EAN13_5, "9781556153952", "12345")
  422.    Call VpeWrite(hDoc, 1350, 1600, 1750, 1800, "EAN-128 A:")
  423.    Call VpeSetBarcodeParms(hDoc, 0, 0)
  424.    Call VpeBarcode(hDoc, 1350, 1660, 1750, 1860, BCT_EAN128A, "EAN-128 A", vbNullString)
  425.    Call VpeWrite(hDoc, 200, 2000, 600, 2200, "EAN-128 B:")
  426.    Call VpeBarcode(hDoc, 200, 2060, 600, 2260, BCT_EAN128B, "ean-128 b", vbNullString)
  427.    Call VpeWrite(hDoc, 700, 2000, 1200, 2200, "EAN-128 C:")
  428.    Call VpeBarcode(hDoc, 700, 2060, 1200, 2260, BCT_EAN128C, "128902", vbNullString)
  429.    Call VpeWrite(hDoc, 1350, 2000, 1850, 2200, "POSTNET (1.20) 5 or 9 digits:")
  430.    Call VpeBarcode(hDoc, 1350, 2060, 1628, 2120, BCT_POSTNET, "12345", vbNullString)
  431.    Call VpeBarcode(hDoc, 1350, 2150, 1850, 2210, BCT_POSTNET, "414649623", vbNullString)
  432.    Call VpePageBreak(hDoc)
  433.    Call VpeSetFontAttr(hDoc, ALIGN_CENTER, 0, 1, 0)
  434.    Call VpeSelectFont(hDoc, "Arial", 18)
  435.    Call VpeWrite(hDoc, 0, 150, 2100, 300, "The supported barcode-types (continued):")
  436.    Call VpeSelectFont(hDoc, "Arial", 10)
  437.    Call VpeSetBold(hDoc, 1)
  438.    Call VpeWrite(hDoc, 200, 300, 550, 400, "UPC-A:")
  439.    Call VpeBarcode(hDoc, 200, 360, 550, 560, BCT_UPCA, "07447079382", vbNullString)
  440.    Call VpeWrite(hDoc, 700, 300, 1100, 400, "UPC-A + 2:")
  441.    Call VpeBarcode(hDoc, 700, 360, 1100, 560, BCT_UPCA_2, "07447079382", "01")
  442.    Call VpeWrite(hDoc, 1350, 300, 1800, 400, "UPC-A + 5:")
  443.    Call VpeBarcode(hDoc, 1350, 360, 1800, 560, BCT_UPCA_5, "03126764825", "94687")
  444.    Call VpeWrite(hDoc, 200, 700, 550, 900, "UPC-E:")
  445.    Call VpeBarcode(hDoc, 200, 760, 550, 960, BCT_UPCE, "0378492", vbNullString)
  446.    Call VpeWrite(hDoc, 700, 700, 1100, 900, "UPC-E + 2:")
  447.    Call VpeBarcode(hDoc, 700, 760, 1100, 960, BCT_UPCE_2, "0378492", "14")
  448.    Call VpeWrite(hDoc, 1350, 700, 1800, 900, "UPC-E + 5:")
  449.    Call VpeBarcode(hDoc, 1350, 760, 1800, 960, BCT_UPCE_5, "0364825", "79462")
  450.    Call VpeSetFontAttr(hDoc, ALIGN_LEFT, 0, 0, 0)
  451.    y = VpeWrite(hDoc, 200, 1100, 1800, VFREE, "VPE supports 21 barcode types. Barcodes can be rotated in 90 degree steps, the text can be drawn on bottom or top of the barcode, and also independently the add-on text. Any of these features can be combined.")
  452.    y = VpePrint(hDoc, 500, y + 100, "[S 24 U C LtYellow]Text and images")
  453.    Call VpePrint(hDoc, VRIGHT, VBOTTOM, "[Rot 900 C Blue] can be freely ")
  454.    Call VpeWriteBox(hDoc, 500, VBOTTOM, VLEFT, VFREE, "[Rot 1800 C Red CE]rotated in 90")
  455.    Rem The WIDTH (after rotation it's the height) is the top of the last inserted text
  456.    Rem minus the bottom of the first inserted object.
  457.    Call VpeWriteBox(hDoc, 400, y, -(VpeGet(hDoc, VTOP) - y), VFREE, "[Rot 2700 C Green]degree steps")
  458. End Sub
  459. Private Sub Page5(ByVal hDoc As Long)
  460.    Dim y, y2, x As Integer
  461.    Dim p As Long
  462.    Call VpePageBreak(hDoc)
  463.    Call VpeUseSet(hDoc, HEADLINE)
  464.    y = VpeWriteBox(hDoc, 100, 200, 2000, -1, "VPE is also able to manage bitmaps for you!" + Chr$(10) + "Place your logo wherever you want.")
  465.    y = VpeWriteBox(hDoc, 100, y, 1400, -1, "[S 10 L BO IO UO](Note: These are 256-color bitmaps, in 16-color mode it doesn't look very good)")
  466.    y = VpeWriteBox(hDoc, 100, y + 50, 1400, -1, "[N B U]VPE supports the following graphics file formats:")
  467.    Call VpeWriteBox(hDoc, 100, y, 1400, -1, "-Windows and OS/2 Bitmaps (2 / 16 / 256 / True Color)" + Chr$(10) + "-Windows WMF (Metafile)" + Chr$(10) + "-AutoCAD DXF" + Chr$(10) + "-GIF (2 / 16 / 256 Colors)" + Chr$(10) + "-PCX (2 / 16 / 256 Colors)" + Chr$(10) + "-JPG (256 / True Color)" + Chr$(10) + "-TIFF 5.0 (2 / 16 / 256 / True Color, LZW / PackBits / Fax G3 & G4 / Tiled Images)" + Chr$(10) + "-Microsoft filters (feature, some restrictions and only 16-bit version)")
  468.    Call VpeSetPen(hDoc, 5, PS_SOLID, COLOR_BLACK)
  469.    Call VpePicture(hDoc, 1400, 150, -1, -1, "logo.bmp", VPE_PIC_KEEPIMAGE + VPE_PIC_KEEP_DIB_PAGE)
  470.    y = VpeGet(hDoc, VBOTTOM)
  471.    x = VpeGet(hDoc, VRIGHT)
  472.    Call VpeWriteBox(hDoc, 1400, y, x, -1, "[N S 14 CE C White BC Red TO Italic Bold]IDEAL Software")
  473.    Call VpeDefaultBitmapDPI(hDoc, 96, 96)
  474.    Call VpePicture(hDoc, 1400, VpeGet(hDoc, VBOTTOM) + 100, -1, -1, "fruits.bmp", VPE_PIC_KEEPIMAGE + VPE_PIC_KEEP_DIB_PAGE)
  475.    y = VpeWriteBox(hDoc, 150, y + 400, 1500, -1, "[S 14 CE PS 0]Scale your bitmaps as you like:")
  476.    y = y + 20
  477.    Call VpeSetPen(hDoc, 3, PS_SOLID, COLOR_BLACK)
  478.    Call VpePicture(hDoc, 150, y, 200, -1, "logo.bmp", VPE_PIC_KEEPIMAGE + VPE_PIC_KEEP_DIB_PAGE)
  479.    Call VpePicture(hDoc, VpeGet(hDoc, VRIGHT) + 100, y, VpeGet(hDoc, VRIGHT) + 250, -1, "logo.bmp", VPE_PIC_KEEPIMAGE + VPE_PIC_KEEP_DIB_PAGE)
  480.    Call VpePicture(hDoc, VpeGet(hDoc, VRIGHT) + 100, y, VpeGet(hDoc, VRIGHT) + 750, -1, "logo.bmp", VPE_PIC_KEEPIMAGE + VPE_PIC_KEEP_DIB_PAGE)
  481.    y = VpeGet(hDoc, VBOTTOM) + 300
  482.    y = VpePrint(hDoc, 150, y, "[N U]Draw! Set the Pen, Background Color and Hatch Style:")
  483.    y = y + 50
  484.    Call VpeSetTransparentMode(hDoc, 0)
  485.    Call VpeSetBkgColor(hDoc, COLOR_BLUE)
  486.    Call VpeBox(hDoc, 150, y, -300, -300)
  487.    Call VpeSetHatchStyle(hDoc, HS_BDIAGONAL)
  488.    Call VpeSetHatchColor(hDoc, COLOR_BLUE)
  489.    Call VpeSetBkgColor(hDoc, COLOR_LTYELLOW)
  490.    Call VpeNoPen(hDoc)
  491.    p = VpePolygon(hDoc, 0, 4)
  492.    Call VpeAddPolygonPoint(hDoc, p, 250, y + 400)
  493.    Call VpeAddPolygonPoint(hDoc, p, 500, y + 600)
  494.    Call VpeAddPolygonPoint(hDoc, p, 300, y + 700)
  495.    Call VpeAddPolygonPoint(hDoc, p, 150, y + 1000)
  496.    Call VpeSetPen(hDoc, 6, PS_SOLID, COLOR_BLACK)
  497.    p = VpePolygon(hDoc, 0, 4)
  498.    Call VpeAddPolygonPoint(hDoc, p, 650, y)
  499.    Call VpeAddPolygonPoint(hDoc, p, 1000, y + 200)
  500.    Call VpeAddPolygonPoint(hDoc, p, 700, y + 300)
  501.    Call VpeAddPolygonPoint(hDoc, p, 550, y + 600)
  502.    Call VpeNoPen(hDoc)
  503.    Call VpeSetHatchStyle(hDoc, HS_DIAGCROSS)
  504.    Call VpeSetHatchColor(hDoc, COLOR_RED)
  505.    Call VpeSetBkgColor(hDoc, COLOR_CYAN)
  506.    Call VpeEllipse(hDoc, 750, 2150, -500, -300)
  507.    Call VpeSetHatchStyle(hDoc, HS_FDIAGONAL)
  508.    Call VpeSetPen(hDoc, 10, PS_SOLID, COLOR_GREEN)
  509.    Call VpeSetTransparentMode(hDoc, 1)
  510.    y2 = VpeWrite(hDoc, 1200, y + 200, -500, -1, "[S 12 B CE]Write text beyond,")
  511.    Call VpeEllipse(hDoc, 1200, y, -500, -500)
  512.    Call VpeWrite(hDoc, 1200, y2, -500, -1, "or above the hatching.")
  513.    Call VpeSetTransparentMode(hDoc, 0)
  514.    Call VpeWriteBox(hDoc, 770, 2280, -460, -1, "[PS 3 PC Black HSN BC Cyan S 10 NB]Or blank the hatching out.")
  515.    Call VpeSetTransparentMode(hDoc, 1)
  516. End Sub
  517. Private Sub Page6(ByVal hDoc As Long)
  518.    Call VpePageBreak(hDoc)
  519.    Call VpeNoPen(hDoc)
  520.    Call VpePicture(hDoc, 0, 0, -1, -1, "gew.tif", VPE_PIC_KEEPIMAGE + VPE_PIC_KEEP_DIB_PAGE)
  521.    Call VpeWrite(hDoc, 250, 110, 1200, -1, "[S 24 C LtRed L PS 0]Stadt Xhausen")
  522.    Call VpeWrite(hDoc, 250, 500, 1000, -1, "[S 14 C Blue]Mustermann & Co." + Chr$(10) + "Feinkost Im- und Export")
  523.    Call VpeWrite(hDoc, 1200, 460, 1700, -1, "[S 11 B]D
  524. sseldorf")
  525.    Call VpeWrite(hDoc, 250, 670, 750, -1, "Schmidt")
  526.    Call VpeWrite(hDoc, 250, 840, 750, -1, "24.7. 1947")
  527.    Call VpeWrite(hDoc, 500, 835, 1000, -1, "Oberammergau")
  528.    Call VpeWrite(hDoc, 250, 1010, 750, -1, "Zunderstr. 93")
  529.    Call VpeWrite(hDoc, 1000, 1000, 1750, -1, "0 27 84 / 16 45 98")
  530.    Call VpeWrite(hDoc, 250, 1255, 1750, -1, "Willi-Graf-Str. 17")
  531.    Call VpeWrite(hDoc, 1000, 1255, 1750, -1, "0 27 84 / 23 54 90")
  532.    Call VpeWrite(hDoc, 1220, 660, 1750, -1, "Heinz - Willi")
  533.    Call VpeWrite(hDoc, 1100, 1500, 1950, -1, "[S 10 J I]It is very important to mention here, that the bitmap form has a resolution of 96 DPI only. The print will not be very nice. Just try a 300 DPI bitmap on your own!")
  534. End Sub
  535. Rem ========================================================================
  536. Rem                              PrintJournal
  537. Rem Structure of input-file
  538. Rem =======================
  539. Rem User-Name
  540. Rem Year
  541. Rem Start Month (or blank)
  542. Rem End Month (or blank)
  543. Rem <@>Table-Name --> start a new table!!!
  544. Rem No.
  545. Rem Date
  546. Rem Amount
  547. Rem Prorated Amount
  548. Rem Tax
  549. Rem Remark
  550. Rem Remark
  551. Rem NOTE: In this demo Y2 has a constant value for much faster processing
  552. Rem ========================================================================
  553. Private Sub Speed_Click()
  554.    Dim hDoc As Long
  555.    Dim s, name, year, period, table As String
  556.    Dim footer_ok, page As Integer
  557.    footer_ok = False
  558.    page = 1
  559.    If Dir("journal.rpt") = "" Then
  560.       MsgText = "ERROR: Report-File not found - generate it."
  561.       Exit Sub
  562.    End If
  563.    Open "journal.rpt" For Input As 1
  564.    hDoc = VpeOpenDoc(hWnd, "Speed + Tables", -1, -1, VPE_NO_USER_CLOSE)
  565.    hSpeed = hDoc
  566.    Call VpeSetAutoBreak(hDoc, AUTO_BREAK_NO_LIMITS)
  567.    Call VpeSetTransparentMode(hDoc, False)
  568.    Rem Read constant data block:
  569.    Rem =========================
  570.    Line Input #1, name
  571.    Line Input #1, year
  572.    Line Input #1, s
  573.       
  574.    Rem do not evaluate period
  575.    period = ""
  576.    Call VpeSetPen(hDoc, 0, 0, COLOR_BLACK)
  577.    Call VpeSetFontAttr(hDoc, ALIGN_CENTER, 0, 1, 0)
  578.    Call VpeSelectFont(hDoc, "Arial", 16)
  579.    Call VpeWriteBox(hDoc, VLEFTMARGIN, VTOPMARGIN, VRIGHTMARGIN, VFREE, "Journal " + year)
  580.    Call VpeSetPen(hDoc, 3, PS_SOLID, COLOR_BLACK)
  581.    Call VpeSetFontAttr(hDoc, ALIGN_LEFT, 0, 0, 0)
  582.    Call VpeSelectFont(hDoc, "Arial", 11)
  583.    Rem process variable data:
  584.    Rem ======================
  585.    While Not EOF(1)
  586.       Line Input #1, s
  587.       If Left$(s, 1) = "@" Then
  588.          Rem Beginning of a new table:
  589.          Rem =========================
  590.          If footer_ok Then
  591.             PrintFooter (hDoc)
  592.          End If
  593.          sum_amount = sum_prorated = sum_tax = 0
  594.          Rem Is the room to the page-bottom big enough for a new table ?
  595.          If VpeGet(hDoc, VBOTTOMMARGIN) - VpeGet(hDoc, VBOTTOM) < 400 Then
  596.             Rem No, add a new page:
  597.             Call PrintPageFooter(hDoc, name, page)
  598.             Call PageBreak(hDoc, page)
  599.             page = page + 1
  600.          Else
  601.             Rem Beginning of new table is 1cm below previous table:
  602.             Call VpeSet(hDoc, VBOTTOM, VpeGet(hDoc, VBOTTOM) + 100)
  603.          End If
  604.          table = Right$(s, Len(s) - 1)
  605.          Call PrintHeader(hDoc, table)
  606.          footer_ok = False
  607.       Else
  608.          Rem list part:
  609.          Rem ==========
  610.          footer_ok = True
  611.          Call VpeSetTransparentMode(hDoc, 1)
  612.          Call VpeSetAlign(hDoc, ALIGN_RIGHT)
  613.          Call VpeWriteBox(hDoc, VLEFTMARGIN, VBOTTOM, -200, -50, s)
  614.          Line Input #1, s
  615.          Call VpeWriteBox(hDoc, VRIGHT, VTOP, -200, VBOTTOM, s)
  616.          Line Input #1, s
  617.          sum_amount = sum_amount + CDbl(s)
  618.          Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, s)
  619.          Line Input #1, s
  620.          sum_prorated = sum_prorated + CDbl(s)
  621.          Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, s)
  622.          Line Input #1, s
  623.          sum_tax = sum_tax + CDbl(s)
  624.          Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, s)
  625.          Line Input #1, s
  626.          Line Input #1, s2
  627.          s = s + " " + s2
  628.          Call VpeSetAlign(hDoc, ALIGN_LEFT)
  629.          Call VpeSelectFont(hDoc, "Arial", 6)
  630.          Call VpeWriteBox(hDoc, VRIGHT, VTOP, VRIGHTMARGIN, VBOTTOM, s)
  631.          Call VpeSelectFont(hDoc, "Arial", 11)
  632.          Call VpeSetTransparentMode(hDoc, 0)
  633.          
  634.          If VpeGet(hDoc, VBOTTOM) + 150 > VpeGet(hDoc, VBOTTOMMARGIN) Then
  635.             Rem Bottom of page reached:
  636.             Rem =======================
  637.             Call PrintFooter(hDoc)
  638.             Call PrintPageFooter(hDoc, name, page)
  639.             Call PageBreak(hDoc, page)
  640.             page = page + 1
  641.             Call PrintHeader(hDoc, table)
  642.          End If
  643.       End If
  644.    Wend
  645.    Close #1
  646.    PrintFooter (hDoc)
  647.    Call PrintPageFooter(hDoc, name, page)
  648.    Call VpeGotoPage(hDoc, 1)
  649.    Call VpeWriteBox(hDoc, 100, 100, 1000, 150, "Generated " + Str(VpeGetPageCount(hDoc)) + " pages out of textfile!")
  650.    MsgText = ""
  651.    rc.Right = -1
  652.    Call VpePreviewDoc(hDoc, rc, VPE_SHOW_MAXIMIZED)
  653. End Sub
  654. Private Sub PrintHeader(hDoc As Long, ByVal table As String)
  655.    Call VpeSetAlign(hDoc, ALIGN_CENTER)
  656.    Call VpeSelectFont(hDoc, "Arial", 14)
  657.    Call VpeSetBkgColor(hDoc, COLOR_LTGRAY)
  658.    Call VpeWriteBox(hDoc, VLEFTMARGIN, VBOTTOM, VRIGHTMARGIN, -60, table)
  659.    Call VpeSetFontAttr(hDoc, ALIGN_CENTER, 1, 0, 0)
  660.    Call VpeSelectFont(hDoc, "Arial", 11)
  661.    Call VpeWriteBox(hDoc, VLEFTMARGIN, VBOTTOM, -200, -50, "No.")
  662.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, -200, VBOTTOM, "Date")
  663.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, "Amount")
  664.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, "Prorated Amount")
  665.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, "Tax")
  666.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, VRIGHTMARGIN, VBOTTOM, "Remark")
  667.    Call VpeSetFontAttr(hDoc, ALIGN_LEFT, 0, 0, 0)
  668.    Call VpeSetBkgColor(hDoc, RGB(255, 255, 255))
  669. End Sub
  670. Private Sub PrintFooter(hDoc As Long)
  671.    Call VpeSetFontAttr(hDoc, ALIGN_CENTER, 1, 0, 0)
  672.    Call VpeSetBkgColor(hDoc, COLOR_LTGRAY)
  673.    Call VpeWriteBox(hDoc, VLEFTMARGIN, VBOTTOM, -400, -50, "Sum")
  674.    Call VpeSetFontAttr(hDoc, ALIGN_RIGHT, 1, 0, 0)
  675.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, Format(sum_amount, "###,###,###.00"))
  676.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, Format(sum_prorated, "###,###,###.00"))
  677.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, -250, VBOTTOM, Format(sum_tax, "###,###,###.00"))
  678.    Call VpeWriteBox(hDoc, VRIGHT, VTOP, VRIGHTMARGIN, VBOTTOM, "")
  679.    Call VpeSetFontAttr(hDoc, ALIGN_LEFT, 0, 0, 0)
  680.    Call VpeSetBkgColor(hDoc, RGB(255, 255, 255))
  681. End Sub
  682. Private Sub PrintPageFooter(hDoc As Long, ByVal name As String, page As Integer)
  683.    Call VpeStorePos(hDoc)
  684.    Call VpeNoPen(hDoc)
  685.    Call VpeWriteBox(hDoc, VLEFTMARGIN, VBOTTOMMARGIN, VpeGet(hDoc, VRIGHTMARGIN) - 400, -50, name)
  686.    Call VpeSetAlign(hDoc, ALIGN_RIGHT)
  687.    Call VpeWriteBox(hDoc, VRIGHT, VBOTTOMMARGIN, VRIGHTMARGIN, -50, Str(page))
  688.    Call VpeSetPen(hDoc, 3, PS_SOLID, COLOR_BLACK)
  689.    Call VpeRestorePos(hDoc)
  690. End Sub
  691. Private Sub PageBreak(hDoc As Long, page As Integer)
  692.    Call VpePageBreak(hDoc)
  693.    If page Mod 10 = 0 Then
  694.       MsgText = "now reading inputfile and generating page " + Str(page)
  695.       MsgText.Refresh
  696.    End If
  697. End Sub
  698. Private Sub SpeedClose_Click()
  699.    Call CloseSpeed
  700. End Sub
  701. Public Sub ClosePrecision()
  702.    If hPrecision Then
  703.       If VpeCloseDoc(hPrecision) Then
  704.          hPrecision = 0
  705.       Else
  706.          MsgText = "Can't close, job 'Precision' is printing!"
  707.       End If
  708.    End If
  709. End Sub
  710. Public Sub CloseSpeed()
  711.    If hSpeed Then
  712.       If VpeCloseDoc(hSpeed) Then
  713.          hSpeed = 0
  714.       Else
  715.          MsgText = "Can't close, job 'Speed' is printing!"
  716.       End If
  717.    End If
  718. End Sub
  719.