[TUT] Fade effect

Posts 15 of 5 · Page 1 of 1
[TUT] Fade effect
hi guys in this tut i show you how to make a fade effect
what we need
2 timers
thats all

set opacity to 0%
timer1 interval = 10
timer2 interval = 10

double click on the form and type in
Code:
Timer1.start
then the code for the 1st timer
Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Opacity += 0.03
        If Opacity = 100 Then
            Timer1.Enabled = False
        End If
    End Sub
then go to the form closing code and type in
Code:
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Timer2.start
    End Sub
and then the code for the 2nd timer
Code:
Opacity -= 0.03
        If Opacity = 0 Then
            End
        End If
VirusTotal

credits to me
Umm, if you do += 0.03, won't it end up on 99->102..never hitting 100? I guess if the thing implicitly casts to an integer is should work.

In future put small snippets like this in the snippets vault rather than making a whole thread about the,

Attachment removed.
you can use this method for other transitions aswell (Y)
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?