您的位置:首页 > 编程语言 > VB

VB.Net实现窗口渐淡关闭的方法

2007-11-27 22:19 447 查看
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

@#1.設視窗為Form1

@#2.將變數命名為d

@#3.依物件名稱適當更改程式碼

End Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: