Public Class FrmWaitingBox
Inherits System.Windows.Forms.Form
Public Sub New(ByVal Method As EventHandler(Of EventArgs), ByVal msg As String)
InitializeComponent()
If Not String.IsNullOrEmpty(msg) Then
lblTip.Text = msg
End If
_Method = Method
End Sub
Private _Method As EventHandler(Of EventArgs)
Private asyncResult As IAsyncResult
Private Sub timer1_Tick(ByVal sender As Object, ByVal e As EventArgs)
If asyncResult.IsCompleted Then
Me.Close()
End If
End Sub
Private Sub FrmWaitingBox_Shown(ByVal sender As Object, ByVal e As EventArgs)
asyncResult = _Method.BeginInvoke(Nothing, Nothing, Nothing,Nothing)
End Sub
Private components As System.ComponentModel.IContainer = Nothing
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.pictureBox1 = New System.Windows.Forms.PictureBox()
Me.lblTip = New System.Windows.Forms.Label()
Me.timer1 = New System.Windows.Forms.Timer(Me.components)
DirectCast(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
' pictureBox1
Me.pictureBox1.Image = System.Drawing.Image.FromFile(ProjectPath & "Loading.gif")
Me.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.pictureBox1.Name = "pictureBox1"
' lblTip
Me.lblTip.AutoSize = True
Me.lblTip.BackColor = System.Drawing.Color.FromArgb((CInt((CByte(20)))), (CInt((CByte(50)))), (CInt((CByte(84)))))
Me.lblTip.Font = New System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (CByte(134)))
Me.lblTip.ForeColor = System.Drawing.Color.White
Me.lblTip.Location = New System.Drawing.Point(130, 223)
Me.lblTip.Name = "lblTip"
Me.lblTip.Size = New System.Drawing.Size(203, 25)
Me.lblTip.Text = "正在处理数据,请等待..."
' timer1
Me.timer1.Enabled = True
Me.timer1.Interval = 500
AddHandler timer1.Tick, AddressOf timer1_Tick
' FrmWaitingBox
Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 12F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Silver
Me.ClientSize = New System.Drawing.Size(460, 280)
Me.Controls.Add(Me.lblTip)
Me.Controls.Add(Me.pictureBox1)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "FrmWaitingBox"
Me.Text = "FrmWaitingBox"
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.TransparencyKey = Color.red
Me.OPacity = 0.9
Me.ShowInTaskbar = False
AddHandler Me.Shown, AddressOf FrmWaitingBox_Shown
DirectCast(Me.pictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Private pictureBox1 As System.Windows.Forms.PictureBox
Private lblTip As System.Windows.Forms.Label
Private WithEvents timer1 As System.Windows.Forms.Timer
End Class