PaintMaxPasses example for Visual Basic

Note: Also works with Access 95 and 97.

This example includes two procedures. First, a button click starts a multi-pass paint effect; then LEAD's PaintNotification event changes the direction of the effect on each pass.

Private Sub StartEffect_Click()
  Lead1.AutoRepaint = False
  Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R 'Set the Effect
  Lead1.PaintMaxPasses = 5                     '5 total passes
  Lead1.PaintPass = 1                          'Start with pass number 1
  Lead1.PaintNotificationDelay = 200          ' Delay 200 milliseconds between passes
  Lead1.Load "c:\lead\images\image1.cmp", 0, 0, 1             'Load the image
  Lead1.AutoRepaint = True
End Sub

Private Sub Lead1_PaintNotification(ByVal uPass As Integer, ByVal uType As Integer)
  'If the first pass is complete
  If ((uType = EFX_NOTIFY_IMAGE) And (uPass > 0)) Then
      'Toggle the effect from left_to_right to right_to_left
      If Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R Then
          Lead1.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
      Else
          Lead1.PaintEffect = EFX_EFFECT_WIPE_L_TO_R
      End If
  End If
End Sub