Easy Transparent Forms with Visual FoxPro

Want an easy way to make your forms transparent in Visual FoxPro? How about a little class to drop on your form.

The TransparentForm class will automagically make your TOP-LEVEL form (ShowWindow = 2) appear semi-transparent.

Note: This works on Top-Level forms running on Windows 2000 or higher only. You won’t see any effect on Windows 98 or on any form that does not have ShowWindow = 2.

Also, this was created with Visual FoxPro 9.0 (it works unchanged in VFP 7 and 8). If you want to run it in VFP 6, you will need to change the references to ThisForm.hWnd.

How do you use it? Drop it on a form, and set the nOpaquePct property to the percentage of opaqueness that you want the form to have (the default is 90).

Here’s a few pictures of the sample form in action:

With 90% ‘Opaqueness’:

 

75% Opaqueness:

 

50% Opaqueness:

 

You can download the class and sample form here (4 kb).

This post originally appeared on the Foxite Weblogs site.