PaintMaxPasses example for C++ Builder

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.

 

void __fastcall TForm1::PaintPassesClick(TObject *Sender)
{
  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;
}

void __fastcall TForm1::Lead1PaintNotify (TObject *Sender, DWORD uPass, DWORD uType)
{
  /*if the first pass is complete, toggle the effect from left_to_right to right_to_left */
  if((uType == EFX_NOTIFY_IMAGE) && (uPass > 0))
     if(Lead1->PaintEffect == EFX_EFFECT_WIPE_L_TO_R)
        Lead1->PaintEffect = EFX_EFFECT_WIPE_R_TO_L;
     else
        Lead1->PaintEffect = EFX_EFFECT_WIPE_L_TO_R;
}