PrimalForms 2011: Create an Awesome Fade In Form

Did you ever want to make your forms a little more flashy? How about creating an Awesome Fade In Form? Yeah that’s right I said Awesome!

[Start Deep Voice]

Everybody loves it when their forms make a smooth entrance. Ohhh Yeahhh…

As opposed to the typical abrupt “here I am” way. But then again, whatever floats your boat baby.

[End Deep voice]

With few simple steps your form will be styling into existence.

Steps to make your Awesome Fade in Form:

Step 1: Use the Alpha Luke!

Well it’s actually called Opacity, but essentially the same as alpha or transparency. You can either set the Form’s Opacity to 0% (Invisible) in the Designer or dynamically set it on the Form’s Load event. In this sample I will set in the Form’s Load event:

$form1.Opacity = 0

Step 2: Add the Timer

Next, add a Timer Control to handle the fade in effect. Change the Timer’s Interval property in order to speed up or slow down the fade in effect.

 Timer Properties

Step 3: Add a Tick Event (Did you hear that? It’s time to be Awesome!)

Now add the Timer’s Tick event and increments the Form’s Opacity until it’s at its full glory:

$timerFadeIn_Tick={
    #Can you see me now?
    if($form1.Opacity -lt 1)
    {
        $form1.Opacity += 0.1
        
        if($form1.Opacity -ge 1)
        {
            #Stop the timer once we are 100% visible
            $timerFadeIn.Stop()
        }
    }
}

Step 4: Let’s get it on!

Let’s get it on (or should I say turn it on?) by starting the Timer on the Forms Load event:

$FormEvent_Load={
    #Start the Timer to Fade In
    $timerFadeIn.Start()
    $form1.Opacity = 0
}

And now we have the Awesome Fade In Form in action:

Start Fade In

Whaaa?!

Fade In Middle

What’s that? It can’t be!

End Fade In

Yeah, that’s right! Its my Awesome Fade In Form!

 

[Start Deep Voice]

Damn… You’re one sexy form!

[End Deep Voice]

Download the Fade In Form Sample from the Download section. That’s right! You can’t keep your hands off it!