Support Forums

Full Version: [Tutorial] Fade In / Out Form [Source]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello SF!
Today I will show you the said subject.

In your Form, Select the Two Timers i.e timer1 and time2. Set the properties as below

timer1 > Enabled = true , Timer = 1
timer2 > Enabled = false , Timer = 1



In your exit application button, use this code...

Code:
private void btnExitApplication_Click(object sender, EventArgs e)
        {
            timer1.Enabled = false;
            timer2.Enabled = true;
        }


Now Double click on timer1 and timer2 respectively and add this code.

Code:
private void timer1_Tick(object sender, EventArgs e)
        {
            Opacity += 0.03;
            if (Opacity == 100)
            {
                timer1.Enabled = false;
            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            Opacity -= 0.03;
            if (Opacity == 0)
            {
                ProjectData.EndApp();
            }
        }

In your Form, Select Opacity = 0%

Thats it!! Tell me how is this work?
Hope you like it.

Regards
Thanks for this, very helpful. Smile
Code:
Private Sub btnExitApplication_Click(sender As Object, e As EventArgs)
    timer1.Enabled = False
    timer2.Enabled = True
End Sub

Code:
Private Sub timer1_Tick(sender As Object, e As EventArgs)
    Opacity += 0.03
    If Opacity = 100 Then
        timer1.Enabled = False
    End If
End Sub

Private Sub timer2_Tick(sender As Object, e As EventArgs)
    Opacity -= 0.03
    If Opacity = 0 Then
        ProjectData.EndApp()
    End If
End Sub
Thanks a great deal for this buddy, I have bookmarked this page.
Thanks for your feedback.
REgards with best wishes