How to Program a Fading Form

In this tutorial we are going to transform the form in to a fading form.

Step 1:

Create a form and add a Picture Box then add a any image you want and set the FormBorderStyle Properties to None in your Form.

Here’s mine:

Step 2:
Copy and Paste the code:

Public Class frmFade
    Dim count As Integer
    Private Sub frmFade_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        For counter = 0 To 100 Step 10
            count = counter
            Me.Opacity = count / 100
            Me.Refresh()
            Threading.Thread.Sleep(100)
        Next counter
        Threading.Thread.Sleep(1000)

        For counters = 100 To 0 Step -10
            count = counters
            Me.Opacity = count / 100
            Me.Refresh()
            Threading.Thread.Sleep(100)
        Next counters
        Me.Close()
    End Sub
End Class
To be able to view the output and make it fade, just run the program. Enjoy!

How to Program a Fading Form How to Program a Fading Form Reviewed by code-dev on 10:53 AM Rating: 5

No comments:

Powered by Blogger.