Solved

Simple animations...tell me EVERYTHING

Posted on 1998-12-02
7
171 Views
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.
0
Comment
Question by:Peanuthead
7 Comments
 
LVL 1

Expert Comment

by:KEWL
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

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

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!




0
 

Author Comment

by:Peanuthead
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.
0
 

Author Comment

by:Peanuthead
ID: 1447914
Anyone else know better how 2 explain?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Expert Comment

by:hckhiu
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.

thanks
keong

0
 

Author Comment

by:Peanuthead
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
0
 
LVL 44

Accepted Solution

by:
bruintje earned 300 total points
ID: 1447917
Hi Peanut,

Well goto the MS site to this link

http://premium.microsoft.com/msdn/library/devprods/vs6/vb/html/vbconusingpictureclipcontrol.htm

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.

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
     Loop
       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.

Pfffffffffffff....................

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

Ok....

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).

Bruintje
0
 
LVL 44

Expert Comment

by:bruintje
ID: 1447918
thanks for the points
:O)
br(UINT)je
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now