C# Tutorial – Spawn Animated Wind mill Images Dynamically Using Paint Event and Animator Class

Hi in this tutorial we will take it one step further from the last tutorial and look at how to spawn animated transparent images to windows forms using the paint and the animator class. This tutorial will use some object oriented programming structure, where we will be making a separate class for the Wind Mills and they will be placed dynamically in the windows form application. We will be binding those windmills to a LIST where we will keep track of the items spawned in the form. This way we will be able to check how many items are inside of the list. In the future tutorials we will also show how to spawn and remove them from the screen. This was a really fun tutorial to make and it opens up a lot of opportunities for us to make fun and responsive applications in visuals studio. Hopefully you find this informative and useful.

Lesson Objectives –

  1. Create a windows form app that spawns multiple windmil images using paint and timer event
  2. Use object oriented programming to create a windmil class and spawn the images using c# script only
  3. Work inside of visual studio to make this application
  4. Use different variables such as Boolean, string, integer and lists to control the application
  5. Use loops, functions and events in the project
  6. Work with transparent images and make sure its all being dynamically painted on the form

 

Video Tutorial –

 

Download the windmill and background images here

 

Form1.cs Source Code

 

Windmill Class Source Code




Comment on this tutorial and let us know how you got on -