CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2001
    Posts
    5

    How do I animate 3 or more images in a control array?

    All I can get is two of the three images to change. Here what I have so far:
    Private Sub Timer1_Timer()

    static i as integer

    i = i + 1
    for i = 3 then i = 0
    imgLight(0).Picture = imgLight(i).Picture
    End Sub

    As you can see I have a timer and an image array with three pictures, but only two will change. What do I need to do to get the third picture to change?



  2. #2
    Join Date
    Jun 2000
    Location
    Nepal
    Posts
    108

    Re: How do I animate 3 or more images in a control array?

    Initially, the form shows imglight(0).picture. Note that imgLight(0).picture is replaced by imglight(1). Then, after the first timer tick, imglight(1).picture will be shown. Then, imglight(2) will be shown. Now, i becomes 3, but you set it to 0. But imglight(0).picture is the same as imglight(1).picture. That's why only two show up.

    Take another picturebox, and show the images on this picturebox. That will solve your problem.


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

Featured