C# Exercises

Home AgriMetSoft About Contact

Make Animation in Winforms C#

	    
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Animation_in_Winforms_Close_Form
{
  public partial class Form1 : Form
  {
    Timer timer1;
    public Form1()
    {
      InitializeComponent();
      timer1 = new Timer();
      timer1.Tick += timer1_Tick;
    }

    private void timer1_Tick(object sender, EventArgs e)
    {
      if (this.Opacity > 0)
      {
        this.Opacity -= 0.07;
      }
      else
      {
        timer1.Stop();
        Application.Exit();
      }
    }

    private void button1_Click(object sender, EventArgs e)
    {
      timer1.Start();
    }

  }
}

		
	 


Download the project of Visual Studio 2013 in DropBox Download


How to use Animation in WinForms C# to Close Form Exit App


List of Exercises