Interesting Animated Background Effect for Forms
Most of you have seen the effect of the Vista dialogs where the background of the form appears to move whe the form is moved. While difficult to describe, it is easy to see and even easier to implement for your forms.
Obviously if you have Vista, then you already have the animated background effect. So this post is aimed at those of us who have upgraded to and still use XP.
This effect is achieved with just 2 lines of code as you will see.
Click on either of the images below to view it at full size and right click and "Save Picture as" somewhere - backgroung.jpg
or 
This will be your background for your form.
So create a new form and drop an image control on it. Make sure you click on it and "Send to Back" or in its INIT add the line
This
.Zorder(0)
to make sure it is always the rearmost item on your form. Now you can either assign the above picture you downloaded as its Picture property or do that in the Form.Init. I prefer the latter:
Form::Init
ThisForm
.Image1.Picture = "background.jpg"
Now to get this animation effect you will need only the following 2 lines of code: So open the Form.Moved and add this code exactly as shown:
WITH This
.Image1
.Left = -ThisForm.left
.Top = -ThisForm.Top
ENDWITH
And yes, that is -Thisform.Left (minus thisform.left) & (minus thisform.Top)
Run the form and see that the form now has the background you set. Now move the form and observe the background appears to move when the form is moved.

And there you have it - an animated background for your form A la Vista with just 2 lines of code. You can also load the above background image into any Paint application and change the colours to suit your theme or make up one of your own.

Unfortunately because of the amount of junk mail being generated from the weblog I have switched off comments. Please post your comments, if any, at www.foxite.com