Private Sub FadeForm(ByVal FType As String)
Select Case FType
Case ("Load")
Me.Opacity = 0
Dim FadeCount As Integer
For FadeCount = 10 To 90 Step 10
Me.Opacity = FadeCount / 100
Me.Refresh()
Threading.Thread.Sleep(10)
Next
Me.Opacity = 1
Case ("Close")
Dim FadeCount As Integer
For FadeCount = 90 To 10 Step -10
Me.Opacity = FadeCount / 100
Me.Refresh()
Threading.Thread.Sleep(10)
Next
Me.Dispose()
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FadeForm("Load")
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
FadeForm("Close")
End Sub
Tidak ada komentar:
Posting Komentar