The Fastest Lightbox Ever
In one of my previous posts I described a Lightbox class that was Activex friendly.
The old post is here:
VFP Lightbox Class - Now Activex Friendly
Unfortunately because of the logic used in the class, for large "busy" forms with a large number of objects, it caused a couple of seconds delay before the lightbox was displayed and even then on slower computers the screen update was noticeably slow.
So I had another look at the logic of the previous version and threw away most of the code. The result is a lean, mean lightbox that is very snappy to display. It now uses only the GDI+X
imgCanvas class exclusively for its display.
To ensure speed the following must be observed:
- The class will only work on a form. It will not support any other containers
- It requires the GDI+x Libraries (system.app and GDIPLUS.VCX/VCT)
- It IS however,Activex friendly
To use it is simplicity itself as shown in the sample form.
Just drop the class on a form and call it as shown.
LPARAMETERS tcMsg
LOCAL lRet as Boolean
ThisForm.bbgdilightbox1.ShowLightbox(.T.)
IF MESSAGEBOX(tcMsg,292,"Are you sure?",0) = 7
lRet = .F.
ELSE
lRet = .T.
ENDIF
ThisForm.bbgdilightbox1.ShowLightbox()
RETURN lRet

In the control.BeforeDraw() method you will find some code like this:
* change the colours as needed here
* possible colours are (220,128,0,0),(220,0,0,128) etc. loBrush = .SolidBrush.New(.Color.FromArgb(
220,0,0,0))
These are
ARGB where the first number denotes the opacity
0 = Full Transparent, 255 = full opaque
The other 3 numbers are just 3 RGB numbers to denote the colour to be used. You can change these to get different lightbox colours as below.
The complete source code and sample form can be downloaded from the attachment link below. Enjoy.

It was also suggested that a shape object be used instead with its
DrawMode property = 9.
While
that would work in some cases, because of the way VFP displays colours,
when the form or image control on the form has a Picture set, this is
the result - 8 bit colours under the control. Also the control can
never support Activex and they come to the top.