[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to make an ANIMATED Background ???

Posted on 1998-06-13
2
Medium Priority
?
237 Views
Last Modified: 2010-05-03
OK, I now know of two simple ways to add background textures to a VB5 Form.
In other words, I know how to add a textured background by putting pictures tiles on the form.

Now the hard question:  How do I add an ANIMATED background to a VB5 form ???
I don't care to use any Draw techniques. I want realistic pictures to be cycled to make
an animated background.

My forms are small, about 1/3 size of screen. I had thought of the following:
Add 6 pcitures, one on top of the next. Then just cycle through these by setting the
Visible attribute on each picture. I think most buttons ect... will stay on top. I haven't tried this.
Any other ideas???
0
Comment
Question by:jgore
2 Comments
 
LVL 5

Accepted Solution

by:
bin_huwairib earned 880 total points
ID: 1463238
jgore,

Use ImageList control in Microsoft Windows Common Controls (COMCTL32.OCX) to store your images and then assign the indexed image with your Picture Box at a specific time, in this case you will only use one Picture Box control instead of having Picture box control for each picture.

Example
=======
1- Add form1 to project1.
2- Add picture1, imagelist1 and timer1 to form1.
3- Paste the following code in form1:

Const ImageCount = 3

Dim ImageIndex As Integer

Private Sub Form_Load()
 ImageIndex = 0
 ImageList1.ListImages.Add , , LoadPicture("c:\windows\Bubbles.bmp")
 ImageList1.ListImages.Add , , LoadPicture("c:\windows\Forest.bmp")
 ImageList1.ListImages.Add , , LoadPicture("c:\windows\Weave2.bmp")
 Timer1.Interval = 500
End Sub

Private Sub Timer1_Timer()
 ImageIndex = ImageIndex + 1
 If ImageIndex > ImageCount Then ImageIndex = 1
 Picture1.Picture = ImageList1.ListImages(ImageIndex).Picture
End Sub


Best regards
Bin Huwairib
0
 

Author Comment

by:jgore
ID: 1463239
Thanks, thats much easier than they way I did it.
I just used 8 images and cycled their Visibilty attribute.
It worked, but your way looks much better. C-ya........
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question