Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. VC# - Draw Image a GIF animation using code

VC# - Draw Image a GIF animation using code

Scheduled Pinned Locked Moved C#
csharphelp
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shailesh Appukuttan
    wrote on last edited by
    #1

    I have a GIF animation which i want to paint in a picturebox. I know that a picturebox is capable of displaying GIF animations when you preload them in the designer etc (i have tried it). But I want to paint it (DrawImage it) on the picturebox control at runtime (I dont want to assign an image directly as it wont work for my project). Is there any way apart from using a timer to alternate between the various images of the animation. Thanks for all the help!!

    C A T 3 Replies Last reply
    0
    • S Shailesh Appukuttan

      I have a GIF animation which i want to paint in a picturebox. I know that a picturebox is capable of displaying GIF animations when you preload them in the designer etc (i have tried it). But I want to paint it (DrawImage it) on the picturebox control at runtime (I dont want to assign an image directly as it wont work for my project). Is there any way apart from using a timer to alternate between the various images of the animation. Thanks for all the help!!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Wow - that's news to me. I've never seen a picturebox play an animated gif and I know there are CP articles on how to get one to play in c#.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      A 1 Reply Last reply
      0
      • C Christian Graus

        Wow - that's news to me. I've never seen a picturebox play an animated gif and I know there are CP articles on how to get one to play in c#.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        A Offline
        A Offline
        Anthony Mushrow
        wrote on last edited by
        #3

        Nope, just checked, animates gif in both .Net 1.1, and 2.0. I we never knew...

        My current favourite word is: Bauble!

        -SK Genius

        1 Reply Last reply
        0
        • S Shailesh Appukuttan

          I have a GIF animation which i want to paint in a picturebox. I know that a picturebox is capable of displaying GIF animations when you preload them in the designer etc (i have tried it). But I want to paint it (DrawImage it) on the picturebox control at runtime (I dont want to assign an image directly as it wont work for my project). Is there any way apart from using a timer to alternate between the various images of the animation. Thanks for all the help!!

          A Offline
          A Offline
          Anthony Mushrow
          wrote on last edited by
          #4

          Anyway, had you looked, im sure you would have found: System.Drawing.ImageAnimator.Animate(Image, onFrameChanged); and System.Drawing.ImageAnimator.UpdateFrames(Image); Animate will use the animations of timing, and call you Frame Chenged event handler (in this case called 'onFrameChanged'), when its time for the next frame. And UpdateFrames will just move on to the next frame, regardless of the time. Google them to find out exactly how they work.

          My current favourite word is: Bauble!

          -SK Genius

          E 1 Reply Last reply
          0
          • A Anthony Mushrow

            Anyway, had you looked, im sure you would have found: System.Drawing.ImageAnimator.Animate(Image, onFrameChanged); and System.Drawing.ImageAnimator.UpdateFrames(Image); Animate will use the animations of timing, and call you Frame Chenged event handler (in this case called 'onFrameChanged'), when its time for the next frame. And UpdateFrames will just move on to the next frame, regardless of the time. Google them to find out exactly how they work.

            My current favourite word is: Bauble!

            -SK Genius

            E Offline
            E Offline
            electriac
            wrote on last edited by
            #5

            Yes picture Box will display animated GIF. I have been doing this since Vis 2003.

            J 1 Reply Last reply
            0
            • S Shailesh Appukuttan

              I have a GIF animation which i want to paint in a picturebox. I know that a picturebox is capable of displaying GIF animations when you preload them in the designer etc (i have tried it). But I want to paint it (DrawImage it) on the picturebox control at runtime (I dont want to assign an image directly as it wont work for my project). Is there any way apart from using a timer to alternate between the various images of the animation. Thanks for all the help!!

              T Offline
              T Offline
              tarasn
              wrote on last edited by
              #6

              Check out this article Strip Images From Animated Gif[^].The article shows how to access a specific frame in gif image. So what you need split the source into frames ,and show them separately using timer ...

              DevIntelligence.com - My blog for .Net Developers

              1 Reply Last reply
              0
              • E electriac

                Yes picture Box will display animated GIF. I have been doing this since Vis 2003.

                J Offline
                J Offline
                jaiswalrahul
                wrote on last edited by
                #7

                But how can you help me how to display animated gif in picturebox for windows mobile 6 using C# Thanks in advance

                E 1 Reply Last reply
                0
                • J jaiswalrahul

                  But how can you help me how to display animated gif in picturebox for windows mobile 6 using C# Thanks in advance

                  E Offline
                  E Offline
                  electriac
                  wrote on last edited by
                  #8

                  I have no experience with Windows Mobile 6.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups