PaintEffect example for Visual Basic

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

Private Sub Lead1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then 'Code for F5
   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 If
End Sub

Private Sub Lead1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 116 Then 'Code for F5
   Lead1.PaintEffect = EFX_EFFECT_WIPE_R_TO_L
   Lead1.ForceRepaint
   Lead1.PaintEffect = EFX_EFFECT_NONE
End If
End Sub