Introduction: VB 08 Form Fade
This is a video I made some time ago (Using Microsoft Visual Basic 2008 Express edition)
showing "HOW I MADE" a Visual Basic Form fade in & out.
Thank you for watching!
I will try to post a sample code soon.
I've since updated to Microsoft Visual Basic 2010 Express Edition.
Upon checking the latest version is Visual Studio Express 2013
Step 1: Form1 Code
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.TickProgressBar1.Increment(+10)
'The higher the increment the faster it will change/fade 'my increment is set to 10 so each time it changes 'my opacity level changes to the corrisponding value
If ProgressBar1.Value = 100 Then Me.Opacity = 1 ProgressBar1.Value = 0 'reset the progress bar to zero
ElseIf ProgressBar1.Value = 90 Then Me.Opacity = 0.9 ElseIf ProgressBar1.Value = 80 Then Me.Opacity = 0.8 ElseIf ProgressBar1.Value = 70 Then Me.Opacity = 0.7 ElseIf ProgressBar1.Value = 60 Then Me.Opacity = 0.6 ElseIf ProgressBar1.Value = 50 Then Me.Opacity = 0.5 ElseIf ProgressBar1.Value = 40 Then Me.Opacity = 0.6 ElseIf ProgressBar1.Value = 30 Then Me.Opacity = 0.7 ElseIf ProgressBar1.Value = 20 Then Me.Opacity = 0.8 ElseIf ProgressBar1.Value = 10 Then Me.Opacity = 0.9
End If End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click 'click this label to toggle the fade on -OR- Off
If Timer1.Enabled = True Then Label1.Text = "Form fade is Off" Timer1.Stop() ElseIf Timer1.Enabled = False Then Label1.Text = "Form fade is On" Timer1.Start() End If End Sub End Class