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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. VC# - How to draw a GIF animation on a picturebox control

VC# - How to draw a GIF animation on a picturebox control

Scheduled Pinned Locked Moved C#
graphicscsharpdata-structurestutorialquestion
4 Posts 4 Posters 1 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 picturebox (imgViewer) which is displaying an image (a map). Now i want to display another image (a smaller one) on top of this image. But this smaller image is a GIF animation of a blinking siren. But when i paint it on the picturebox, the overlapping of the two images is being displayed properly, but it comes as a static image with only the first frame of the animation being shown. This is the code I am using: private void btn_Path_Click(object sender, EventArgs e) { Bitmap path = new Bitmap(@"C:\Engg\Siren.JPG"); Graphics graph = Graphics.FromImage( this.imgViewer.Image ); graph.DrawImage(path, 0, 0); graph.Dispose(); } (Thanks to CKnig for the code above) How can i make the GIF animation properly display as I want the blinking effect. Thanks in advance!!

    C X 2 Replies Last reply
    0
    • S Shailesh Appukuttan

      I have a picturebox (imgViewer) which is displaying an image (a map). Now i want to display another image (a smaller one) on top of this image. But this smaller image is a GIF animation of a blinking siren. But when i paint it on the picturebox, the overlapping of the two images is being displayed properly, but it comes as a static image with only the first frame of the animation being shown. This is the code I am using: private void btn_Path_Click(object sender, EventArgs e) { Bitmap path = new Bitmap(@"C:\Engg\Siren.JPG"); Graphics graph = Graphics.FromImage( this.imgViewer.Image ); graph.DrawImage(path, 0, 0); graph.Dispose(); } (Thanks to CKnig for the code above) How can i make the GIF animation properly display as I want the blinking effect. Thanks in advance!!

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

      You can't. A picture box shows one image, and it's not animated.

      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 )

      E 1 Reply Last reply
      0
      • S Shailesh Appukuttan

        I have a picturebox (imgViewer) which is displaying an image (a map). Now i want to display another image (a smaller one) on top of this image. But this smaller image is a GIF animation of a blinking siren. But when i paint it on the picturebox, the overlapping of the two images is being displayed properly, but it comes as a static image with only the first frame of the animation being shown. This is the code I am using: private void btn_Path_Click(object sender, EventArgs e) { Bitmap path = new Bitmap(@"C:\Engg\Siren.JPG"); Graphics graph = Graphics.FromImage( this.imgViewer.Image ); graph.DrawImage(path, 0, 0); graph.Dispose(); } (Thanks to CKnig for the code above) How can i make the GIF animation properly display as I want the blinking effect. Thanks in advance!!

        X Offline
        X Offline
        Xmen Real
        wrote on last edited by
        #3

        here are solutions: http://www.c-sharpcorner.com/UploadFile/mgold/AnimationComponent09142005062332AM/AnimationComponent.aspx[^] http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=501614&SiteID=1[^]

        Becoming Programmer...

        1 Reply Last reply
        0
        • C Christian Graus

          You can't. A picture box shows one image, and it's not animated.

          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 )

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

          PictureBox can display animated GIF. I do this frequently.

          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