Private waitMess As New System.Windows.Forms.Form()
'等待窗体
Private sFlog As Boolean = True
Private Sub ShowWaitMess()
Dim waitMesspic As New System.Windows.Forms.PictureBox()
waitMesspic.Image = System.Drawing.Image.FromFile(ProjectPath & "Images\loading.gif")
waitMesspic.Dock = System.Windows.Forms.DockStyle.Fill
waitMesspic.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
waitMess.Controls.Add(waitMesspic)
waitMess.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
waitMess.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
waitMess.TransparencyKey = Color.red
waitMess.OPacity = 0.9
waitMess.Width = 1280/1.5 '固定大小
waitMess.Height = 720/1.5
'waitMess.Width = SysInfo.WorkingAreaWidth '屏幕大小
'waitMess.Height = SysInfo.WorkingAreaHeight
Try
If Not waitMess.IsDisposed Then
waitMess.ShowDialog()
End If
Catch Err As System.Threading.ThreadAbortException
MessageBox.Show(Err.Message)
End Try
End Sub
Public Sub WaitShow()
Try
If sFlog = True Then
sFlog = False
Dim upgradeThread As System.Threading.Thread = Nothing
upgradeThread = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf ShowWaitMess))
upgradeThread.Start()
End If
Catch Err As System.Threading.ThreadAbortException
MessageBox.Show(Err.Message)
End Try
End Sub
Private Delegate Sub CloseFormDelegate()
Public Sub WaitClose()
If waitMess.InvokeRequired Then
waitMess.Invoke(New CloseFormDelegate(AddressOf DoCloseJob))
Else
DoCloseJob()
End If
End Sub
private Sub DoCloseJob()
Try
If Not waitMess.IsDisposed Then
sFlog = True
waitMess.Close()
End If
Catch Err As System.Threading.ThreadAbortException
MessageBox.Show(Err.Message)
End Try
End Sub