Simple animations...tell me EVERYTHING

Posted on 1998-12-02
Medium Priority
Last Modified: 2010-05-03
Hello...this is a REALLY easy question that i want explained in lots of detail for me to accept your answer.  I want to know exactly how to use bitmaps to create animations.  Keep in mind...i dont know how to use the move command...dont make any statements assuming i know what im doing...cause i barely do....ive only been doing visual basic for a month...and thats only been semi-simple stuff....so speak as if im a child...exact code helps, along with comments to explain the code...this questions worth alot...so im expecting alot.
Question by:Peanuthead
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1447912
first create an 'image' control on the form called 'img' and place it where you want to show the animation

then create another one with the same name and click 'yes' when the box pops up. set the property 'visible' to false

then use the folowing code

numframes= [ enter number of frames here ]
for a = 1 to numframes
on error resume next
load img(a)
img(a).picture=loadpicture("image" + str(a) + ".bmp")
next a

for a = 1 to numframes
img(0).left=img(0).left + 10
next a

that will make the animation move across the form.
p.s I have assumed the images are image1.bmp image2.bmp etc

it is also an infinite loop.if you have a problem with that, and cant fix it yourself, leave a comment here, and i will tell you.

 I better post this messge b4 any one else does eh!


Author Comment

ID: 1447913
I need more info.....I need to know first off where to put da code...in form load or in picture click?  Also, what directory must the pics be stored in.  How do i make it a not-unlimited loop also....ill need to know that.

Author Comment

ID: 1447914
Anyone else know better how 2 explain?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Expert Comment

ID: 1447915
simple, just like drawing cartoon, you draw a few picture with each one move a little bit or change a bit (using any drawing program you prefer or just draw and scan it).

than put one picturebox for each of your image, if you got ten image, then put ten picturebox into VB form (form1).

1. put all the pictureboxs at the same place and with same size.
2. make all the picturebox visible to false, so you won't see anything in screen.
3. than at form load event or at button, make the picturebox display one by one, each time only one picturebox is visible.



Author Comment

ID: 1447916
I need more specific...like how to make it all into one function.  I also need to know HOW to make them display one by one....u need to assume that im stupid....heh
LVL 44

Accepted Solution

bruintje earned 1200 total points
ID: 1447917
Hi Peanut,

Well goto the MS site to this link


Great plus to use this is, that you can store as many pieces of your animation in one bitmap to use it with the control

But hey we are gonna build some things ourselves.....

Grab the bitmap picture on the page, they use in their example and save it as a bitmap on your disk.

Go back to your VB and open a new project..........

If you can't find the pictureclip control on your toolbar you can search for it by rightclicking on the toolbar and choosing components. There will be a list showing all the available controls on your machine. Look for the "Microsoft PictureClip Control 5.0(or  6.0), check the checkbox and choose OK.


Now you have the control on your toolbar, and a sample bitmap on your disk, so lets get to work.

Place a command button, timer control, picture control and a pictureclip control on your form.

Put this code in your form1 code unit

Private Sub Form_Load()
   Timer1.Enabled = False
   PictureClip1.cols = 6
   PictureClip1.Rows = 3
End Sub

And this in your commandbutton click

Dim A, PauseTime, Start, Finish As Integer

Private Sub Command1_Click()
   For A = 0 To 17
   Picture1.Picture = PictureClip1.GraphicCell(A)
   PauseTime = 1   ' Set duration.
   Start = Timer   ' Set start time.
     Do While Timer < Start + PauseTime
       Finish = Timer  ' Set end time.
     Next A
End Sub

This should be working, you run the project and by clicking on the button the 18 pieces of the bitmap will being displayed in the picturcontrol at a rate of one per second.


(this is my second try to post this, the first time my browser paralized....)


BTW I can send you the whole project if you want to take a look at it and play with this. It's about 164 kb icluded the bitmap.
email mulbum@worldonline.nl

Tough one here......just started today with VB5, but loving to take it on beside my real exp.(Delphi).

LVL 44

Expert Comment

ID: 1447918
thanks for the points

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

650 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