Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6872991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:59:59+00:00 2026-05-27T03:59:59+00:00

How to DrawImage without losing animation? pictureBox1.Image = new Bitmap(20, 20); Graphics g =

  • 0

How to DrawImage without losing animation?

        pictureBox1.Image = new Bitmap(20, 20);
        Graphics g = Graphics.FromImage(pictureBox1.Image);
        Image i = Properties.Resources.SuperMario; //Animated GIF; sprite; 20px X 20px
        g.DrawImage(i, 
            new Rectangle(0, 0, 20, 20),
            new Rectangle(0, 0, 20, 20),
            GraphicsUnit.Pixel);
        pictureBox1.Refresh();

The above codes, copies image portion from an animated sprite sheet (GIF format) to PictureBox‘ Image. Unfortunately, the animation is lost.

This is the sprite sheet: http://www.google.com/imgres?q=sprite+20×20&um=1&hl=en&client=firefox-a&rls=org.mozilla:en-US:official&biw=1067&bih=671&tbm=isch&tbnid=ulN4JRy6N4ToSM:&imgrefurl=http://nkelsch.deviantart.com/art/Super-Mario-20×20-Sprites-83482505&docid=GOCF1PgjPytbPM&imgurl=http://www.deviantart.com/download/83482505/Super_Mario_20x20_Sprites_by_nkelsch.gif&w=251&h=356&ei=4orQTvXPIKePiAerio24Dg&zoom=1&iact=hc&vpx=89&vpy=154&dur=7579&hovh=267&hovw=188&tx=131&ty=137&sig=107474527571502851152&page=1&tbnh=122&tbnw=86&start=0&ndsp=18&ved=1t:429,r:0,s:0

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:59:59+00:00Added an answer on May 27, 2026 at 3:59 am

    Load the entire gif in picture box and position it such that only relevant portion is shown in picture box. Thats how sprites work. You don’t have to copy the portion of a particular frame because yes that would obviously lose animation.

    Put your picture box inside a panel and then set the location of picture box to the position of sprite element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Drawing a parallelgram is nicely supported with Graphics.DrawImage: Bitmap destImage = new Bitmap(srcImage.Width, srcImage.Height);
I'm using Graphics.DrawImage to write a index bitmap into another image. The color black
Should be a quick and easy question. Does System.Drawing.Graphics.DrawImage() or Image.Save() by default make
It is not well known , that if you draw an image, e.g.: graphics.DrawImage(image,
I resized the picture into 100x100 size by using Graphics class and drawImage() method.
I have identified this call as a bottleneck in a high pressure function. graphics.DrawImage(smallBitmap,
function SetImage(planViewCanvas, context, componentID) { var img = new Image(); img.onload = function ()
I want to draw an image over other without drawing its backgroud. The image
I have a problem with image scaling in .NET. I use the standard Graphics
I create image in this way: var orc = new Image(); orc.src = ./orc.png;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.