home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l408 / 2.img / EXAMPLES.EXE / EXAMPLES / FX / FX.SUB < prev   
Encoding:
Text File  |  1992-10-12  |  22.1 KB  |  627 lines

  1. ' These are the graphics special effects routines
  2. Dim SourceWidth As Integer, SourceHeight As Integer
  3. Dim DestWidth As Integer, DestHeight As Integer
  4. Dim DestX As Integer, DestY As Integer
  5. Dim TempWidth As Integer, TempHeight As Integer
  6. Dim WidthFactor As Single, HeightFactor As Single
  7. Dim X As Integer, LoopCounter As Integer
  8. Dim SaveRedraw As Integer    ' For special effects
  9.  
  10. ' All picture scalemodes must be 1 (Twips) or 3 (Pixels)
  11.  
  12. ' Source and Work pictures must have AutoRedraw = MhTrue
  13.  
  14. ' When diagonal (or other angled) lines are present in
  15. ' the bitmaps, best results are obtained when the
  16. ' destination picturebox size is exactly proportional
  17. ' to the source picturebox.
  18.  
  19. ' Best results are obtained when the BorderStyle of all
  20. ' pictureboxes are identical.
  21.  
  22. Sub MhVRotate (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  23.  
  24.     Const Cycles = 6            ' Number of cycles per effect
  25.     FixupSizes Dest, Work, Work2
  26.     ' Copy the destination picture to the work picture
  27.     MhStretchBlt Dest, Work
  28.     X = DoEvents()              ' Make sure the sizes "take"
  29.  
  30.     ' Get our working values
  31.     CalculateValues Source, Dest, Cycles
  32.  
  33.     ' Now squeeeeze the destination picture so it appears
  34.     ' to be rotating around.
  35.  
  36.     ' Calculate value to reduce, and then increase width by each cycle
  37.     TempWidth = DestWidth + 1       ' So we end up with 2 pixel wide axis
  38.     For LoopCounter = 1 To Cycles
  39.     ' Calculate new width
  40.     TempWidth = TempWidth - WidthFactor
  41.     ' Calculate new X point
  42.     DestX = (DestWidth - TempWidth) \ 2
  43.     Work2.Cls            ' Clear the second work box
  44.     ' Stretch the work box into the second work box
  45.     X = StretchBlt(Work2.hDC, DestX, 0, TempWidth, DestHeight, Work.hDC, 0, 0, DestWidth, DestHeight, SRCCOPY)
  46.     ' Copy second work box to destination box
  47.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work2.hDC, 0, 0, SRCCOPY)
  48.     Next
  49.  
  50.     ' Copy the source picture to the first work picture
  51.     MhStretchBlt Source, Work
  52.  
  53.     ' Get our working values
  54.     CalculateValues Source, Dest, Cycles
  55.  
  56.     ' Now expand into the destination box, giving the effect of rotation
  57.  
  58.     For LoopCounter = 1 To Cycles
  59.     Work2.Cls            ' Clear the second work box
  60.     ' Stretch the work box into the second work box
  61.     X = StretchBlt(Work2.hDC, DestX, 0, TempWidth, DestHeight, Work.hDC, 0, 0, DestWidth, DestHeight, SRCCOPY)
  62.     ' Copy second work box to destination box
  63.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work2.hDC, 0, 0, SRCCOPY)
  64.     ' Calculate new width
  65.     TempWidth = TempWidth + WidthFactor
  66.     ' Calculate new X point
  67.     DestX = (DestWidth - TempWidth) \ 2
  68.     Next
  69.     ' Finally, copy Source to Dest in case last copy above was not full copy
  70.     FinalStretch Work, Dest
  71.  
  72. End Sub
  73.  
  74. Sub MhHRotate (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  75.     
  76.     Const Cycles = 6            ' Number of cycles per effect
  77.     FixupSizes Dest, Work, Work2
  78.     ' Copy the destination picture to the work picture
  79.     MhStretchBlt Dest, Work
  80.     X = DoEvents()              ' Make sure the sizes "take"
  81.  
  82.     ' Get our working values
  83.     CalculateValues Source, Dest, Cycles
  84.  
  85.     ' Now squeeeeze the destination picture so it appears
  86.     ' to be rotating around.
  87.  
  88.     ' Calculate value to reduce, and then increase height by each cycle
  89.     TempHeight = DestHeight + 1       ' So we end up with 2 pixel high axis
  90.     For LoopCounter = 1 To Cycles
  91.     ' Calculate new Height
  92.     TempHeight = TempHeight - HeightFactor
  93.     ' Calculate new X point
  94.     DestY = (DestHeight - TempHeight) \ 2
  95.     Work2.Cls            ' Clear the second work box
  96.     ' Stretch the work box into the second work box
  97.     X = StretchBlt(Work2.hDC, 0, DestY, DestWidth, TempHeight, Work.hDC, 0, 0, DestWidth, DestHeight, SRCCOPY)
  98.     ' Copy second work box to destination box
  99.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work2.hDC, 0, 0, SRCCOPY)
  100.     Next
  101.  
  102.     ' Copy the source picture to the first work picture
  103.     MhStretchBlt Source, Work
  104.  
  105.     ' Get our working values
  106.     CalculateValues Source, Dest, Cycles
  107.  
  108.     ' Now expand into the destination box, giving the effect of rotation
  109.  
  110.     For LoopCounter = 1 To Cycles
  111.     Work2.Cls            ' Clear the second work box
  112.     ' Stretch the work box into the second work box
  113.     X = StretchBlt(Work2.hDC, 0, DestY, DestWidth, TempHeight, Work.hDC, 0, 0, DestWidth, DestHeight, SRCCOPY)
  114.     ' Copy second work box to destination box
  115.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work2.hDC, 0, 0, SRCCOPY)
  116.     ' Calculate new width
  117.     TempHeight = TempHeight + HeightFactor
  118.     ' Calculate new Y point
  119.     DestY = (DestHeight - TempHeight) \ 2
  120.     Next
  121.     ' Finally, copy Source to Dest in case last copy above was not full copy
  122.     FinalStretch Work, Dest
  123.     
  124. End Sub
  125.  
  126. Sub MhExplode (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  127.  
  128.     Const Cycles = 8            ' Number of cycles per effect
  129.     ' This routine explodes Source picturebox into Dest picturebox
  130.  
  131.     FixupSizes Dest, Work, Work2
  132.     ' Copy the source picture to the work picture
  133.     MhStretchBlt Source, Work
  134.  
  135.     ' Get our working values
  136.     CalculateValues Source, Dest, Cycles
  137.  
  138.     For LoopCounter = 1 To Cycles
  139.     ' Calculate new X point
  140.     DestX = (DestWidth - TempWidth) \ 2
  141.     ' Calculate new Y point
  142.     DestY = (DestHeight - TempHeight) \ 2
  143.     ' Stretch the work box into the second work box
  144.     X = StretchBlt(Work2.hDC, DestX, DestY, TempWidth, TempHeight, Work.hDC, 0, 0, DestWidth, DestHeight, SRCCOPY)
  145.     ' Copy second work box to destination box
  146.     X = BitBlt(Dest.hDC, DestX, DestY, TempWidth, TempHeight, Work2.hDC, DestX, DestY, SRCCOPY)
  147.     ' Calculate new width/height
  148.     TempWidth = TempWidth + WidthFactor
  149.     TempHeight = TempHeight + HeightFactor
  150.     Next
  151.  
  152.     ' Finally, copy Source to Dest in case last copy above was not full copy
  153.     FinalStretch Work, Dest
  154.  
  155. End Sub
  156.  
  157. Sub MhImplode (Dest As Control, Work As Control, Work2 As Control)
  158.     
  159.     Const Cycles = 12            ' Number of cycles per effect
  160.     ' This effect implodes Dest picturebox into itself
  161.  
  162.     ' For this routine, we double the cycles value because we do only
  163.     ' a single effect.
  164.  
  165.     FixupSizes Dest, Work, Work2
  166.     ' Copy the source picture to the work picture
  167.     MhStretchBlt Dest, Work
  168.  
  169.     ' Get our working values
  170.     CalculateValues Dest, Dest, Cycles
  171.  
  172.     ' Calculate value to decrease width/height by each cycle
  173.     TempWidth = DestWidth
  174.     TempHeight = DestHeight
  175.     For LoopCounter = 1 To Cycles
  176.     ' Calculate new width/height
  177.     TempWidth = TempWidth - WidthFactor
  178.     TempHeight = TempHeight - HeightFactor
  179.     ' Calculate new X point
  180.     DestX = (DestWidth - TempWidth) \ 2
  181.     ' Calculate new Y point
  182.     DestY = (DestHeight - TempHeight) \ 2
  183.     Work2.Cls       ' Clear second work box
  184.     ' Stretch the work box into the second work box
  185.     X = StretchBlt(Work2.hDC, DestX, DestY, TempWidth, TempHeight, Work.hDC, 0, 0, DestWidth, DestHeight, SRCCOPY)
  186.     ' Copy second work box to destination box
  187.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work2.hDC, 0, 0, SRCCOPY)
  188.     Next
  189.     Dest.AutoRedraw = MhTrue
  190.     Dest.Cls    ' Clear it in case last one wasn't zeros
  191.     Dest.AutoRedraw = SaveRedraw        ' Restore state you passed
  192.  
  193. End Sub
  194.  
  195. Sub CalculateValues (Source As Control, Dest As Control, Cycles As Integer)
  196.  
  197.     Dim Divisor As Integer, Edge As Integer
  198.     If Source.BorderStyle Then
  199.        Edge = 1
  200.     Else
  201.        Edge = 0
  202.     End If
  203.     If Source.ScaleMode = 1 Then
  204.        Divisor = 15
  205.     Else
  206.        Divisor = 1
  207.     End If
  208.     SourceWidth = Source.ScaleWidth \ Divisor - Edge * 2
  209.     SourceHeight = Source.ScaleHeight \ Divisor - Edge * 2
  210.     If Dest.BorderStyle Then
  211.        Edge = 1
  212.     Else
  213.        Edge = 0
  214.     End If
  215.     If Dest.ScaleMode = 1 Then
  216.        Divisor = 15
  217.     Else
  218.        Divisor = 1
  219.     End If
  220.     DestWidth = Dest.ScaleWidth \ Divisor - Edge * 2
  221.     DestHeight = Dest.ScaleHeight \ Divisor - Edge * 2
  222.     WidthFactor = DestWidth / Cycles
  223.     HeightFactor = DestHeight / Cycles
  224.     ' These next two are used by several routines
  225.     TempWidth = WidthFactor
  226.     TempHeight = HeightFactor
  227.  
  228. End Sub
  229.  
  230. Sub MhStretchBlt (Source As Control, Dest As Control)
  231.  
  232.     ' This sub simply does a StretchBlt from the Source Picturebox
  233.     ' to the Destination Picturebox
  234.  
  235.     CalculateValues Source, Dest, 1
  236.     X = StretchBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Source.hDC, 0, 0, SourceWidth, SourceHeight, SRCCOPY)
  237.  
  238. End Sub
  239.  
  240. Sub FixupSizes (Dest As Control, Work As Control, Work2 As Control)
  241.     
  242.     ' Make sure that both work boxes are same dimensions
  243.     ' as destination box
  244.     Work.Width = Dest.Width
  245.     Work.Height = Dest.Height
  246.     Work2.Width = Dest.Width
  247.     Work2.Height = Dest.Height
  248.     X = DoEvents()              ' Make sure the sizes "take"
  249.     SaveRedraw = Dest.AutoRedraw ' Save for restoring later
  250.     Dest.AutoRedraw = MhFalse
  251.  
  252. End Sub
  253.  
  254. Sub MhPushRight (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  255.  
  256.     Const Cycles = 24            ' Number of cycles per effect
  257.     FixupSizes Dest, Work, Work2
  258.     ' Copy the destination picture to the work picture
  259.     MhStretchBlt Dest, Work
  260.     ' Copy the source picture to the work2 picture
  261.     MhStretchBlt Source, Work2
  262.     X = DoEvents()              ' Make sure the sizes "take"
  263.  
  264.     ' Get our working values
  265.     CalculateValues Source, Dest, Cycles
  266.     For LoopCounter = 1 To Cycles
  267.     ' Copy rightmost portion of Work2 (source) to left part of Dest
  268.     X = BitBlt(Dest.hDC, 0, 0, TempWidth, DestHeight, Work2.hDC, DestWidth - TempWidth, 0, SRCCOPY)
  269.     ' Copy leftmost portion of Work (original Dest) to right part of Dest
  270.     X = BitBlt(Dest.hDC, TempWidth, 0, DestWidth - TempWidth, DestHeight, Work.hDC, 0, 0, SRCCOPY)
  271.     TempWidth = TempWidth + WidthFactor!
  272.     If TempWidth > DestWidth Then
  273.        Exit For
  274.     End If
  275.     MhFxDelay 2000
  276.     Next
  277.     
  278.     ' Finally, copy Source to Dest in case last copy above was not full copy
  279.     FinalStretch Work2, Dest
  280.  
  281. End Sub
  282.  
  283. Sub MhPushLeft (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  284.  
  285.     Const Cycles = 24            ' Number of cycles per effect
  286.     FixupSizes Dest, Work, Work2
  287.     ' Copy the destination picture to the work picture
  288.     MhStretchBlt Dest, Work
  289.     ' Copy the source picture to the work2 picture
  290.     MhStretchBlt Source, Work2
  291.     X = DoEvents()              ' Make sure the sizes "take"
  292.  
  293.     ' Get our working values
  294.     CalculateValues Source, Dest, Cycles
  295.     For LoopCounter = 1 To Cycles
  296.     ' Copy rightmost portion of Work (original destination) to left part of Dest
  297.     X = BitBlt(Dest.hDC, 0, 0, DestWidth - TempWidth, DestHeight, Work.hDC, TempWidth, 0, SRCCOPY)
  298.     ' Copy leftmost portion of Work2 (source) to right part of Dest
  299.     X = BitBlt(Dest.hDC, DestWidth - TempWidth, 0, TempWidth, DestHeight, Work2.hDC, 0, 0, SRCCOPY)
  300.     TempWidth = TempWidth + WidthFactor
  301.     If TempWidth > DestWidth Then
  302.        Exit For
  303.     End If
  304.     MhFxDelay 2000
  305.     Next
  306.     
  307.     ' Finally, copy Source to Dest in case last copy above was not full copy
  308.     FinalStretch Work2, Dest
  309.  
  310. End Sub
  311.  
  312. Sub MhPushUp (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  313.  
  314.     Const Cycles = 24            ' Number of cycles per effect
  315.     FixupSizes Dest, Work, Work2
  316.     ' Copy the destination picture to the work picture
  317.     MhStretchBlt Dest, Work
  318.     ' Copy the source picture to the work2 picture
  319.     MhStretchBlt Source, Work2
  320.     X = DoEvents()              ' Make sure the sizes "take"
  321.  
  322.     ' Get our working values
  323.     CalculateValues Source, Dest, Cycles
  324.     For LoopCounter = 1 To Cycles
  325.     ' Copy bottommost portion of Work (original destination) to top part of Dest
  326.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight - TempHeight, Work.hDC, 0, TempHeight, SRCCOPY)
  327.     ' Copy topmost portion of Work2 (source) to bottom part of Dest
  328.     X = BitBlt(Dest.hDC, 0, DestHeight - TempHeight, DestWidth, TempHeight, Work2.hDC, 0, 0, SRCCOPY)
  329.     TempHeight = TempHeight + HeightFactor
  330.     If TempHeight > DestHeight Then
  331.        Exit For
  332.     End If
  333.     MhFxDelay 2000
  334.     Next
  335.     
  336.     ' Finally, copy Source to Dest in case last copy above was not full copy
  337.     FinalStretch Work2, Dest
  338. End Sub
  339.  
  340. Sub MhPushDown (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  341.  
  342.     Const Cycles = 24            ' Number of cycles per effect
  343.     FixupSizes Dest, Work, Work2
  344.     ' Copy the destination picture to the work picture
  345.     MhStretchBlt Dest, Work
  346.     ' Copy the source picture to the work2 picture
  347.     MhStretchBlt Source, Work2
  348.     X = DoEvents()              ' Make sure the sizes "take"
  349.  
  350.     ' Get our working values
  351.     CalculateValues Source, Dest, Cycles
  352.     For LoopCounter = 1 To Cycles
  353.     ' Copy topmost portion of Work (original destination) to bottom part of Dest
  354.     X = BitBlt(Dest.hDC, 0, TempHeight, DestWidth, DestHeight - TempHeight, Work.hDC, 0, 0, SRCCOPY)
  355.     ' Copy bottommost portion of Work2 (source) to top part of Dest
  356.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, TempHeight, Work2.hDC, 0, DestHeight - TempHeight, SRCCOPY)
  357.     TempHeight = TempHeight + HeightFactor
  358.     If TempHeight > DestHeight Then
  359.        Exit For
  360.     End If
  361.     MhFxDelay 2000
  362.     Next
  363.     
  364.     ' Finally, copy Source to Dest in case last copy above was not full copy
  365.     FinalStretch Work2, Dest
  366.  
  367. End Sub
  368.  
  369. Sub MhOverlayUp (Source As Control, Dest As Control, Work As Control)
  370.  
  371.     Const Cycles = 24            ' Number of cycles per effect
  372.     FixupSizes Dest, Work, Work
  373.     ' Copy the source picture to the work picture
  374.     MhStretchBlt Source, Work
  375.     X = DoEvents()              ' Make sure the sizes "take"
  376.  
  377.     ' Get our working values
  378.     CalculateValues Source, Dest, Cycles
  379.     For LoopCounter = 1 To Cycles
  380.     ' Copy topmost portion of Work (source) to bottom part of Dest
  381.     X = BitBlt(Dest.hDC, 0, DestHeight - TempHeight, DestWidth, TempHeight, Work.hDC, 0, 0, SRCCOPY)
  382.     TempHeight = TempHeight + HeightFactor
  383.     If TempHeight > DestHeight Then
  384.        Exit For
  385.     End If
  386.     MhFxDelay 2000
  387.     Next
  388.     ' Finally, copy Source to Dest in case last copy above was not full copy
  389.     FinalStretch Work, Dest
  390.  
  391. End Sub
  392.  
  393. Sub MhOverlayDown (Source As Control, Dest As Control, Work As Control)
  394.  
  395.     Const Cycles = 24            ' Number of cycles per effect
  396.     FixupSizes Dest, Work, Work
  397.     ' Copy the source picture to the work picture
  398.     MhStretchBlt Source, Work
  399.     X = DoEvents()              ' Make sure the sizes "take"
  400.  
  401.     ' Get our working values
  402.     CalculateValues Source, Dest, Cycles
  403.     For LoopCounter = 1 To Cycles
  404.     ' Copy bottommost portion of Work (source) to top part of Dest
  405.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, TempHeight, Work.hDC, 0, DestHeight - TempHeight, SRCCOPY)
  406.     TempHeight = TempHeight + HeightFactor
  407.     If TempHeight > DestHeight Then
  408.        Exit For
  409.     End If
  410.     MhFxDelay 2000
  411.     Next
  412.     ' Finally, copy Source to Dest in case last copy above was not full copy
  413.     FinalStretch Work, Dest
  414.  
  415. End Sub
  416.  
  417. Sub MhOverlayRight (Source As Control, Dest As Control, Work As Control)
  418.  
  419.     Const Cycles = 24            ' Number of cycles per effect
  420.     FixupSizes Dest, Work, Work
  421.     ' Copy the source picture to the work picture
  422.     MhStretchBlt Source, Work
  423.     X = DoEvents()              ' Make sure the sizes "take"
  424.  
  425.     ' Get our working values
  426.     CalculateValues Source, Dest, Cycles
  427.     For LoopCounter = 1 To Cycles
  428.     ' Copy leftmost portion of Work (source) to right part of Dest
  429.     X = BitBlt(Dest.hDC, DestWidth - TempWidth, 0, TempWidth, DestHeight, Work.hDC, 0, 0, SRCCOPY)
  430.     TempWidth = TempWidth + WidthFactor
  431.     If TempWidth > DestWidth Then
  432.        Exit For
  433.     End If
  434.     MhFxDelay 2000
  435.     Next
  436.     ' Finally, copy Source to Dest in case last copy above was not full copy
  437.     FinalStretch Work, Dest
  438.  
  439. End Sub
  440.  
  441. Sub MhOverlayLeft (Source As Control, Dest As Control, Work As Control)
  442.  
  443.     Const Cycles = 24            ' Number of cycles per effect
  444.     FixupSizes Dest, Work, Work
  445.     ' Copy the source picture to the work picture
  446.     MhStretchBlt Source, Work
  447.     X = DoEvents()              ' Make sure the sizes "take"
  448.  
  449.     ' Get our working values
  450.     CalculateValues Source, Dest, Cycles
  451.     For LoopCounter = 1 To Cycles
  452.     ' Copy rightmost portion of Work (source) to left part of Dest
  453.     X = BitBlt(Dest.hDC, 0, 0, TempWidth, DestHeight, Work.hDC, DestWidth - TempWidth, 0, SRCCOPY)
  454.     TempWidth = TempWidth + WidthFactor
  455.     If TempWidth > DestWidth Then
  456.        Exit For
  457.     End If
  458.     MhFxDelay 2000
  459.     Next
  460.     ' Finally, copy Source to Dest in case last copy above was not full copy
  461.     FinalStretch Work, Dest
  462.  
  463. End Sub
  464.  
  465. Sub MhVCurtainClose (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  466.  
  467.     Const Cycles = 24            ' Number of cycles per effect
  468.     FixupSizes Dest, Work, Work2
  469.     ' Copy the dest picture to the work2 picture
  470.     MhStretchBlt Source, Work2
  471.     X = DoEvents()              ' Make sure the sizes "take"
  472.  
  473.     ' Get our working values
  474.     CalculateValues Source, Dest, Cycles
  475.     For LoopCounter = 1 To Cycles
  476.     ' Copy Dest picture to Work picture
  477.     X = BitBlt(Work.hDC, 0, 0, DestWidth, DestHeight, Dest.hDC, 0, 0, SRCCOPY)
  478.     
  479.     ' Copy rightmost part of left half of source
  480.     ' picture to left side of work picture
  481.     X = BitBlt(Work.hDC, 0, 0, TempWidth, DestHeight, Work2.hDC, (DestWidth \ 2) - TempWidth, 0, SRCCOPY)
  482.     
  483.     ' Copy leftmost part of right half of source
  484.     ' picture to right side of work picture
  485.     X = BitBlt(Work.hDC, DestWidth - TempWidth, 0, TempWidth, DestHeight, Work2.hDC, (DestWidth \ 2), 0, SRCCOPY)
  486.  
  487.     ' Finally, copy entire Work to Dest
  488.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work.hDC, 0, 0, SRCCOPY)
  489.  
  490.     TempWidth = TempWidth + WidthFactor!
  491.     If TempWidth * 2 > DestWidth Then
  492.        Exit For
  493.     End If
  494.     Next
  495.     
  496.     ' Finally, copy Source to Dest in case last copy above was not full copy
  497.     FinalStretch Source, Dest
  498.  
  499. End Sub
  500.  
  501. Sub MhVCurtainOpen (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  502.  
  503.     Const Cycles = 24        ' Number of cycles per effect
  504.     FixupSizes Dest, Work, Work2
  505.     ' Copy the dest picture to the work2 picture
  506.     MhStretchBlt Dest, Work2
  507.     X = DoEvents()              ' Make sure the sizes "take"
  508.  
  509.     ' Get our working values
  510.     CalculateValues Source, Dest, Cycles
  511.     TempWidth = DestWidth \ 2 - WidthFactor
  512.     For LoopCounter = 1 To Cycles
  513.     ' Copy Source picture to Work picture
  514.     X = StretchBlt(Work.hDC, 0, 0, DestWidth, DestHeight, Source.hDC, 0, 0, SourceWidth, SourceHeight, SRCCOPY)
  515.  
  516.     ' Copy rightmost part of left half of original dest
  517.     ' picture to left side of work picture
  518.     X = BitBlt(Work.hDC, 0, 0, TempWidth, DestHeight, Work2.hDC, (DestWidth \ 2) - TempWidth, 0, SRCCOPY)
  519.     
  520.     ' Copy leftmost part of right half of original dest
  521.     ' picture to right side of work picture
  522.     X = BitBlt(Work.hDC, DestWidth - TempWidth, 0, TempWidth, DestHeight, Work2.hDC, (DestWidth \ 2), 0, SRCCOPY)
  523.  
  524.     ' Finally, copy entire Work to Dest
  525.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work.hDC, 0, 0, SRCCOPY)
  526.  
  527.     TempWidth = TempWidth - WidthFactor!
  528.     If TempWidth < 1 Then
  529.        Exit For
  530.     End If
  531.     Next
  532.     
  533.     ' Finally, copy Source to Dest in case last copy above was not full copy
  534.     FinalStretch Source, Dest
  535.  
  536. End Sub
  537.  
  538. Sub MhHCurtainClose (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  539.  
  540.     Const Cycles = 24            ' Number of cycles per effect
  541.     FixupSizes Dest, Work, Work2
  542.     ' Copy the dest picture to the work2 picture
  543.     MhStretchBlt Source, Work2
  544.     X = DoEvents()              ' Make sure the sizes "take"
  545.  
  546.     ' Get our working values
  547.     CalculateValues Source, Dest, Cycles
  548.     For LoopCounter = 1 To Cycles
  549.     ' Copy Dest picture to Work picture
  550.     X = BitBlt(Work.hDC, 0, 0, DestWidth, DestHeight, Dest.hDC, 0, 0, SRCCOPY)
  551.     
  552.     ' Copy bottommost part of top half of source
  553.     ' picture to top side of work picture
  554.     X = BitBlt(Work.hDC, 0, 0, DestWidth, TempHeight, Work2.hDC, 0, (DestHeight \ 2) - TempHeight, SRCCOPY)
  555.     
  556.     ' Copy topmost part of bottom half of source
  557.     ' picture to bottom of work picture
  558.     X = BitBlt(Work.hDC, 0, DestHeight - TempHeight, DestWidth, TempHeight, Work2.hDC, 0, (DestHeight \ 2), SRCCOPY)
  559.  
  560.     ' Finally, copy entire Work to Dest
  561.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work.hDC, 0, 0, SRCCOPY)
  562.  
  563.     TempHeight = TempHeight + HeightFactor!
  564.     If TempHeight * 2 > DestHeight Then
  565.        Exit For
  566.     End If
  567.     Next
  568.     
  569.     ' Finally, copy Source to Dest in case last copy above was not full copy
  570.     FinalStretch Source, Dest
  571.  
  572. End Sub
  573.  
  574. Sub MhHCurtainOpen (Source As Control, Dest As Control, Work As Control, Work2 As Control)
  575.     
  576.     Const Cycles = 24            ' Number of cycles per effect
  577.     FixupSizes Dest, Work, Work2
  578.     ' Copy the dest picture to the work2 picture
  579.     MhStretchBlt Dest, Work2
  580.     X = DoEvents()              ' Make sure the sizes "take"
  581.  
  582.     ' Get our working values
  583.     CalculateValues Source, Dest, Cycles
  584.     TempHeight = DestHeight \ 2 - WidthFactor
  585.     For LoopCounter = 1 To Cycles
  586.     ' Copy Source picture to Work picture
  587.     X = StretchBlt(Work.hDC, 0, 0, DestWidth, DestHeight, Source.hDC, 0, 0, SourceWidth, SourceHeight, SRCCOPY)
  588.     
  589.     ' Copy bottommost part of top half of original dest
  590.     ' picture to top of work picture
  591.     X = BitBlt(Work.hDC, 0, 0, DestWidth, TempHeight, Work2.hDC, 0, DestHeight \ 2 - TempHeight, SRCCOPY)
  592.     
  593.     ' Copy topmost part of bottom half of source
  594.     ' picture to bottom of work picture
  595.     X = BitBlt(Work.hDC, 0, DestHeight - TempHeight, DestWidth, TempHeight, Work2.hDC, 0, DestHeight \ 2, SRCCOPY)
  596.  
  597.     ' Finally, copy entire Work to Dest
  598.     X = BitBlt(Dest.hDC, 0, 0, DestWidth, DestHeight, Work.hDC, 0, 0, SRCCOPY)
  599.  
  600.     TempHeight = TempHeight - HeightFactor!
  601.     If TempHeight < 1 Then
  602.        Exit For
  603.     End If
  604.     Next
  605.     
  606.     ' Finally, copy Source to Dest in case last copy above was not full copy
  607.     FinalStretch Source, Dest
  608.  
  609. End Sub
  610.  
  611. Sub MhFxDelay (Delay As Integer)
  612.  
  613.     ' This Sub simply causes a delay between BitBlt
  614.     ' calls in order to slow down the special effects
  615.     For I% = 1 To Delay
  616.     Next
  617.  
  618. End Sub
  619.  
  620. Sub FinalStretch (Src As Control, Des As Control)
  621.     Des.AutoRedraw = MhTrue               ' Cause VB to save
  622.     MhStretchBlt Src, Des
  623.     Des.Refresh
  624.     Des.AutoRedraw = SaveRedraw         ' Restore state you passed
  625. End Sub
  626.  
  627.