导航

VB.NET窗口渐淡关闭

Posted on 2009-08-15 19:26  yunbo  阅读(286)  评论(0编辑  收藏  举报
 

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

If MsgBox("請注意看關閉的視窗", MsgBoxStyle.Question + MsgBoxStyle.OKCancel, "關閉") = MsgBoxResult.OK Then

Dim d As Double

For d = 1 To 0 + 0.2 Step -0.2

System.Threading.Thread.Sleep(50)

Application.DoEvents()

Me.Opacity = d

Me.Refresh()

Next d

Else

e.Cancel = True

End If