Using the Load and Unload events of the Forms add these subs to handle a simple fade in and out effect. This is not limited to just one form. The subroutine definition can be added to any global class allowing the use on any form or sub-form.
'Handle Fade in of form Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_ Handles MyBase.Load fade_in() End Sub 'Handle Fade Out of form Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing fade_out() End Sub 'Fade in Public Sub fade_in() For FadeIn = 0.0 To 1.1 Step 0.1 Me.Opacity = FadeIn Me.Refresh() Threading.Thread.Sleep(100) Next End Sub 'Fade out: Public Sub fade_out() For FadeOut = 90 To 10 Step -10 Me.Opacity = FadeOut / 100 Me.Refresh() Threading.Thread.Sleep(50) Next End Sub
About the Author
I am a network engineer that loves to code. I started on the Aquarius systems, and used just about every system until the home brew revolution started. Since then I have been an IT technician that loves to code and fix things that most people can't. This is my way of thanking those who have taught me well. I hope that I can help with any code that is puzzling to the masses.