Animated GIF in PictureBox Not Moving

L

Liz

All:

Can anyone tell me why my animated GIF does not show up
as animated when put into a pictureBox??

Thanks.
Liz
 
H

Herfried K. Wagner [MVP]

* "Liz said:
Can anyone tell me why my animated GIF does not show up
as animated when put into a pictureBox??

Who knows. Please provide some more details on the image.

Have a look at thge 'ImageAnimator' class too.
 
L

Liz

It's a standard animated image. I've put it into a
picture box on my form. It happily animates while I'm in
design mode, but when I actually run the program I get
mixed results. Sometimes it animates correctly and
sometimes it's frozen. Note that I'm executing the same
piece of code over and over without change and I still
see the variable behavior in the image.

As for the ImageAnimator class, how would I incorporate
that with a PictureBox?

Thanks.
L.
 
J

james

I just did a simple test using an animated GIF file and a picturebox
control. I loaded the gif in the Form Load event like so: PictureBox1.Image
= Image.FromFile("C:\checking.gif") and it works fine. Maybe, your problem
is you are setting the .Image source from Design Mode instead of doing it
from Form Load. Try setting the image source in code instead of in the Form
Designer and see if that fixes your problem.
james
 
H

Herfried K. Wagner [MVP]

* "james said:
I just did a simple test using an animated GIF file and a picturebox
control. I loaded the gif in the Form Load event like so: PictureBox1.Image
= Image.FromFile("C:\checking.gif") and it works fine. Maybe, your problem
is you are setting the .Image source from Design Mode instead of doing it
from Form Load. Try setting the image source in code instead of in the Form
Designer and see if that fixes your problem.

That's an interesting point!
 
T

Tom Leylan

Let me suggest what is bound to be controversial :) Rather than "suppose"
that setting it from design mode might not work why wouldn't a person simply
test out the theory? And having done that there would then be no reason to
post "maybe that's the problem" because it uhhh, won't be.

Computer software development clearly isn't a "science" yet.

(To the original poster) Consider creating a new project, drop a picturebox
onto a form and add your animated gif image. If that doesn't work (confirm
the thing is an animated gif) and if it is, post the image or place it on a
webpage where one of us can download it from.
 
H

Herfried K. Wagner [MVP]

Tom,

* "Tom Leylan said:
Let me suggest what is bound to be controversial :) Rather than "suppose"
that setting it from design mode might not work why wouldn't a person simply
test out the theory? And having done that there would then be no reason to
post "maybe that's the problem" because it uhhh, won't be.

When working with animated GIFs on my machine, I /never/ experienced the
problem the OP experienced. It's maybe a problem with the GIF file the
OP is using, so it IMO doesn't make much sense to play around with
another file.
onto a form and add your animated gif image. If that doesn't work (confirm
the thing is an animated gif) and if it is, post the image or place it on a
webpage where one of us can download it from.

Good idea!
 
T

Tom Leylan

To clarify... somebody posted "try to assign the image in code" which is
what I was writing about. If that person had attached the image in the
designer (as a test) then suggesting "maybe it has something to do with the
designer" wouldn't have been necessary. There would be no question that
there wasn't a problem.
 
J

james

I posted "try to asign the image in code" because after trying it myself,
referencing an animated GIF from the Form Designer, the animation DID NOT
WORK. Referencing the animated GIF in Code
DID WORK. So, what makes you think there was no reason to suggest that
there might be a problem
with attaching the image to the picturebox thru the Form Designer? What, in
your opinion, is wrong with suggesting other solutions to someone when what
they have been trying does not work for them and when another person has
tried the same thing and it did not work for them either?
Or are you just being some sort of language police and complaining about my
form of writing and offering different other help? Did you not think my
statements were clear enough?
I simply offered the original poster another way to accomplish their goal
when the way they had tried first did not work and they came here and asked
for help.
Besides, if you had bothered to read what I posted, I gave a code example on
how to go about loading the animated gif into the picturebox control when
the form loaded.
james

Tom Leylan said:
To clarify... somebody posted "try to assign the image in code" which is
what I was writing about. If that person had attached the image in the
designer (as a test) then suggesting "maybe it has something to do with the
designer" wouldn't have been necessary. There would be no question that
there wasn't a problem.


Herfried K. Wagner said:
reason
 
H

Herfried K. Wagner [MVP]

* "Tom Leylan said:
To clarify... somebody posted "try to assign the image in code" which is
what I was writing about. If that person had attached the image in the
designer (as a test) then suggesting "maybe it has something to do with the
designer" wouldn't have been necessary. There would be no question that
there wasn't a problem.

ACK. Maybe the person answering that read the thread about ImageLists +
Alpha channels where the designer converted the images to bitmaps
automatically.
 
J

james

Clearly you don't bother to read before posting. I didn't "suppose", I
proved that there was a problem and provided code to show how to accomplish
what the OP wanted.
And READING before responding clearly isn't a "science" yet, either.
If the best YOU can do is criticize another person's wording of their
response to another person's request for help, then maybe, you should just
butt out.

james

Tom Leylan said:
Let me suggest what is bound to be controversial :) Rather than "suppose"
that setting it from design mode might not work why wouldn't a person simply
test out the theory? And having done that there would then be no reason to
post "maybe that's the problem" because it uhhh, won't be.

Computer software development clearly isn't a "science" yet.

(To the original poster) Consider creating a new project, drop a picturebox
onto a form and add your animated gif image. If that doesn't work (confirm
the thing is an animated gif) and if it is, post the image or place it on a
webpage where one of us can download it from.


the
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top