Animating Window Form (Fade Effect)


To make application look better we have use some eye candy to it. Like in some crack program you have seen when they start they are visible smoothly. Here we are going to make the same fade effect animation using very simple code.

Form while initializing ...                                               form after fade effect..



Windows Form .net 2.0/3.5




1.NET Framework 2.0/3.5
2. Visual Studio 2005/2008


It is very simple to use this code just 2-4 line of code


-> start with new windows form project 

-> drag drop timer component from the toolbar on to form say timer1

Now to display fade effect we should first make the form 100% transparent then after the form will be displayed smoothly.

To do so in form' load event write code like below

private void Form1_Load(object sender, EventArgs e)
    // Set Form's Transperancy 100 %
    this.Opacity = 0;

    // Start the Timer To Animate Form
    timer1.Enabled = true;

And in timer's tick Event Write code like below.

private void timer1_Tick(object sender, EventArgs e)
    // Make Form Visible a Bit more on Every timer Tick
    this.Opacity += 0.07;

Run Project you are done!!