PaintMaxPasses example for Delphi

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

procedure TForm1.PaintPassesClick(Sender: TObject);
begin
  Lead1.AutoRepaint := False;
  {Set the effect}
  Lead1.PaintEffect := EFX_EFFECT_WIPE_L_TO_R; 
  Lead1.PaintMaxPasses := 5;          {5 total passes}
  Lead1.PaintPass := 1;               {Start with pass number 1}
  Lead1.PaintNotificationDelay := 200;  {Delay 200 milliseconds between passes}
  Lead1.EffectDelay := 10;
  Lead1.Load ('c:\lead\images\image1.cmp', 0, 0, 1); {load the image}
  Lead1.AutoRepaint := True;
end;

procedure TForm1.Lead1PaintNotify(Sender: TObject; uPass,
  uType: Cardinal);
begin
  {If the first pass is complete, toggle the effect from left_to_right to right_to_left }
  If ((uType = EFX_NOTIFY_IMAGE) And (uPass > 0)) Then
     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;