• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

Simple animations...tell me EVERYTHING

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.
1 Solution
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!

PeanutheadAuthor Commented:
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.
PeanutheadAuthor Commented:
Anyone else know better how 2 explain?
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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.


PeanutheadAuthor Commented:
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
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).

thanks for the points
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now