HI Guys,
I am beginner in c#. I need to animate an Image like fade in , fade out,change of color etc on clicking a button in my project.. so please tell me the code for this
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Feb 28, 2010, 11:32 PM EST
you can Do Animation using ImageAnimator Class using System; using System.Drawing; using System.Windows.Forms; public class animateImage : Form { //Create a Bitmpap Object. Bitmap animatedImage = new Bitmap("SampleAnimation.gif"); bool currentlyAnimating = false; //This method begins the animation. public void AnimateImage() { if (!currentlyAnimating) { //Begin the animation only once. ImageAnimator.Animate(animatedImage, new EventHandler(this.OnFrameChanged)); currentlyAnimating = true; } } private void OnFrameChanged(object o, EventArgs e) { //Force a call to the Paint event handler. this.Invalidate(); } protected override void OnPaint(PaintEventArgs e) { //Begin the animation. AnimateImage(); //Get the next frame ready for rendering. ImageAnimator.UpdateFrames(); //Draw the next frame in the animation. e.Graphics.DrawImage(this.animatedImage, new Point(0, 0)); }Balaji Essakki19 reputationPosted Feb 28, 2010, 11:45 PM EST
Raaj KumarRank #7,836 · 233 reputationPosted Mar 1, 2010, 12:18 AM EST
You can also try with AJAX control.
http://www.dotnetheaven.com/UploadFile/prathore/ImageAnimation05252007061020AM/ImageAnimation.aspx
http://blogs.msdn.com/brada/archive/2006/11/01/ajax-animations-with-the-asp-net-ajax-toolkit.aspx
Regards,
raaj