Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- e.Cancel = True
- Me.Opacity = 1
- Dim tmr As New Timer
- tmr.Interval = 100
- tmr.Start()
- AddHandler tmr.Tick, AddressOf fadeOUT_tick
- End Sub
- Private Sub fadeOUT_tick(ByVal sender As Object, ByVal e As System.EventArgs)
- Me.Opacity -= 0.1
- Label1.Text = Me.Opacity.ToString
- If Me.Opacity = 0 Then
- CType(sender, Timer).Stop()
- Me.Dispose()
- End If
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Me.Opacity = 0
- Dim tmr As New Timer
- tmr.Interval = 100
- tmr.Start()
- AddHandler tmr.Tick, AddressOf fadeIN_tick
- If Me.Opacity >= 1 Then
- MessageBox.Show("Form Loaded")
- tmr.Stop()
- End If
- End Sub
- Private Sub fadeIN_tick(ByVal sender As Object, ByVal e As System.EventArgs)
- Me.Opacity += 0.1
- Label1.Text = Me.Opacity.ToString
- If Me.Opacity = 1 Then
- CType(sender, Timer).Stop()
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment