PaintEffect example for Delphi

The following modules use the KeyDown and KeyUp events to repaint the image with effects:

procedure TForm1.Lead1KeyDown (Sender: TObject; var Key: Word;  Shift: TShiftState);
begin

If Key = 116 Then {Code for F5}
begin
   Lead1.AutoRepaint := False;
   Lead1.BackErase := True;
   Lead1.EffectGrain := 20;
   Lead1.EffectDelay := 50;
   Lead1.WandSize := 5;
   Lead1.WandColor := RGB(255,255,0);   {Yellow Wand}
   Lead1.PaintEffect := EFX_EFFECT_WIPE_L_TO_R;
   Lead1.ForceRepaint();
end;
end;

procedure TForm1.Lead1KeyUp (Sender: TObject; var Key: Word;  Shift: TShiftState);
begin

If Key = 116 Then {Code for F5}
begin
   Lead1.PaintEffect := EFX_EFFECT_WIPE_R_TO_L;
   Lead1.ForceRepaint();
   Lead1.PaintEffect := EFX_EFFECT_NONE;
end;
end;