Results 1 to 11 of 11

Thread: Animation in Visual Basic5.0

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Indonesia and Philippines
    Posts
    90

    Animation in Visual Basic5.0

    Hi to all members.

    I'm doing my thesis for undergraduate course.
    I'm using PictureBox to put for example 3 pictures there. I'm using timer to change the picture. Is it possible to make the effect like 3D? what I mean is the previous picture will change slowly and the next picture will appear slowly. U can see the process of changing the picture slowly. Because what I experiencing before using timer is, the picture will change right away without seeing the process of changing picture.
    Thank you.

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Animation in Visual Basic5.0

    That should look like 3D? That's an interesting opinion.

    Anyway, if you are using the same pictures all the time, you should make the "intermediate" pictures by hand and put them into the loop as well.
    If the pictures can change, you would need to "process" those pictures to make it look that way. One way for this processing could be to use opacity (if that's available in VB5), but that is just a rough idea.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Indonesia and Philippines
    Posts
    90

    Re: Animation in Visual Basic5.0

    Quote Originally Posted by opus
    Anyway, if you are using the same pictures all the time, you should make the "intermediate" pictures by hand and put them into the loop as well.
    What do you mean by that statement? Anyway the 3 pictures that I will be using will be totally different. The effect that I refering to is like animation in Adobe Photoshop. Could we really do that? If yes, how to do that and please show me sample codes for that.
    Thank you.

  4. #4
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: Animation in Visual Basic5.0

    What I meant was to use something like Photoshop to make the additional pictures that are needed to show any kind of animation!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  5. #5
    Lively Member
    Join Date
    Jan 2008
    Posts
    70

    Re: Animation in Visual Basic5.0

    Don't know how this can be 3D, but

    If you can use direct3d in VB5 (I don't see why not) then you could do this by putting each picture in a texture, stacked in the Z-direction, and changing the alpha values on the textures to make each one more or less transparent.

    You could also do it by hand. Interpolate between the R,G,B values for the two pictures.

    You can read the value of a pixel in a picture box using
    picBoxName.Point(x, y)
    This returns a long which can be split up into R,G,B.

    You can write to a pixel in a picture box using
    picBoxName.PSet (x, y), color

    This way would be slower and probably take more coding than direct3d.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Indonesia and Philippines
    Posts
    90

    Re: Animation in Visual Basic5.0

    Is it possible to put the picture inside the PictureBox when you run the program? What I mean is not through going the properties and click the icon.
    I just want the user to put by his/herself the picture. If yes, what is the code to doing that?

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Animation in Visual Basic5.0

    You use LoadPicture, eg:
    Code:
    Set picBoxName.Picture = LoadPicture("c:\folder\picture.jpg")

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Indonesia and Philippines
    Posts
    90

    Re: Animation in Visual Basic5.0

    What I mean is the user will insert the picture by his/herself? If the case is we already have the picture, we can do that. But how about if the user just added the picture to the computer and he/she want to put the picture when the program is running?
    Assume that the user is only using the program. I as a programmer want to make a code where the user can put any picture that he/she like eventhough they insert a new picture that they just added.
    I hope you get my point.
    Thanks.

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Animation in Visual Basic5.0

    If you want the user to select a file, use a CommonDialog.

    There is a tutorial on it (which is listed in our FAQs as "How can I show an "Open" or "Save" dialog?") here.

    Ignore the "To Save" parts, and you only want the first 5 lines of the "To Load" example.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Jan 2008
    Location
    Indonesia and Philippines
    Posts
    90

    Re: Animation in Visual Basic5.0

    The code is for text, how about for picture, what code should I use?

  11. #11
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Animation in Visual Basic5.0

    The code is for selecting a file to open (which is stored to the FileName variable).. lines 9 to 12 are for opening a text based file, so replace them with appropriate code for loading the type of file you want (like I posted in this thread).

    You will probably want to change the .Filter line, but you can work out how to do that from the help (just click on Filter in the code, then press F1).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width