A developer I know recently purchased a set of high-quality GIF images to adorn the buttons in his application. But although all the GIFs included a transparent background layer, VFP insisted on rendering each of the images with a white rectangle as the background. He asked me how he could get VFP to respect the images' transparency.
VFP has supported transparency in GIFs since version 6 -- but only for the Image control. However, if you use a given image more than once in an application, VFP only stores one copy of it. If that copy happens to be in an Image control, then other copies will respect the transparency.
The trick then, is to create an Image object before you instantiate any of the other controls that use the GIF. The image doesn’t have to be visible, and doesn’t even need to be retained after it’s been created. For example, if you execute the following code:
loImg = CREATEOBJECT("Image")
loImg.Picture = "Customer.GIF"
RELEASE loImg
then all subsequent uses of the GIF in question will respect the transparency.
-- Mike Lewis, contributing editor