程序运行时弹出模式等待框
Dim frm As New Wait
WriteOnly Property isWait() As Boolean
Set(ByVal Value As Boolean)
If Value Then
Dim tWait As New Thread(AddressOf OpenWait)
tWait.Name = "wait"
tWait.Start()
Else
frm.Close()
End If
End Set
End Property
Private Sub OpenWait()
Dim sY, sX As Int32
sX = (Me.Width - frm.Width) / 2
sY = (Me.Height - frm.Height) / 2 - 20
frm.Location = Me.PointToScreen(New Point(sX, sY))
frm.ShowDialog()
End Sub
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
Me.StatusBar1.Text = "运行中。。。"
Application.DoEvents()
Me.isWait = True
Dim s As Int64 = 0
For i As Int64 = 0 To 599999999
s += 1
Next
Me.isWait = False
Me.StatusBar1.Text = "完成。"
End Sub
WriteOnly Property isWait() As Boolean
Set(ByVal Value As Boolean)
If Value Then
Dim tWait As New Thread(AddressOf OpenWait)
tWait.Name = "wait"
tWait.Start()
Else
frm.Close()
End If
End Set
End Property
Private Sub OpenWait()
Dim sY, sX As Int32
sX = (Me.Width - frm.Width) / 2
sY = (Me.Height - frm.Height) / 2 - 20
frm.Location = Me.PointToScreen(New Point(sX, sY))
frm.ShowDialog()
End Sub
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
Me.StatusBar1.Text = "运行中。。。"
Application.DoEvents()
Me.isWait = True
Dim s As Int64 = 0
For i As Int64 = 0 To 599999999
s += 1
Next
Me.isWait = False
Me.StatusBar1.Text = "完成。"
End Sub
源代码: /Files/zhmvb/Wait.rar