1 Replies - 9910 Views - Last Post: 06 June 2012 - 02:06 AM

#1 Alyssa Saila  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 72
  • Joined: 07-January 12

Using Animation In Windows Forms With Visual Studio

Posted 07 April 2012 - 07:56 AM

I'm not exactly sure where to start...

But the first quick thought I had to create animation in forms would be using the shockwave flash object?

Is dropping a .swf file on my form best practice for animation? Or does it make my app too dependent on Adobe Flash if I do this?

I guess my question ultimately is, what should I start learning, or working on to create animation in my C# windows form applications?

By animation I simply mean small sparkles for instances that sparkle around a button when the mouse hovers over it, or a small banner at the top of my windows form that glows or ripples when the form is loaded (simple animations like this).

Is This A Good Question/Topic? 0
  • +

Replies To: Using Animation In Windows Forms With Visual Studio

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 4839
  • View blog
  • Posts: 15,978
  • Joined: 05-May 12

Re: Using Animation In Windows Forms With Visual Studio

Posted 06 June 2012 - 02:06 AM

The types of animation you described are done by simple use of GDI and/or GDI operations that you can find on the Graphics object. They watch for particular events like the mouse entering or leaving or focus entering or leaving, etc. They will render the first step of their animation, and then start a timer. The timer tick events match up with a steps in the animation.

Look at this sample code here where the most basic "effect" is done by painting the blue rectangle: http://msdn.microsof...ntrol.show.aspx

If you are serious about learning about this, Petzold's Programming Windows in C# covers a lot of ground about various ways of using the Graphics object, along with all other aspects of WinForms programming.

Another approach to doing animations is through WPF, but it is tied to having a WPF app rather than a WinForms app. Again it is based on events and steps of animation, but WPF is more declarative in the way you define the effects. Often the effect you want is readily available and you don't have to resort to writing code to get the effect that you want.

This post has been edited by Skydiver: 06 June 2012 - 02:13 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1