How To Make Fade Effect In VB.NET

fade in / out , fade in when your app starts and fade out when your app getting closed .

you just need to add these codes , fade in for form_load and fade out for form_closing.

Public Class Form1
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        For FadeOut = 90 To 10 Step -10
            Me.Opacity = FadeOut / 100
            Me.Refresh()
            Threading.Thread.Sleep(50)
        Next
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For FadeIn = 0.0 To 1.1 Step 0.1
            Me.Opacity = FadeIn
            Me.Refresh()
            Threading.Thread.Sleep(100)
        Next
    End Sub
End Class
preview -

4 comments

wow... this is really cool :D thanks you :D

Reply

How do you make an object such as a label fade in?

Reply

I think you can just use this code for a label, just give a try. I haven't tried .

Reply

Post a Comment

Note: Only a member of this blog may post a comment.