VB 中添加进度条

来源:互联网 发布:图片处理器软件 编辑:程序博客网 时间:2024/05/18 16:13

加载时如果没有进度条会给人舒服的感觉,以下是进度条的代码,在加载函数前StartProgressBar(),执行完之后EndProgressBar()

#Region "进度条"    '''==================进度条Begin========================================================================    Private ProgressForSwitchFormT1 As ProgressForSwitchForm    Private ThreadT2 As Thread    Private Sub ShowProgressForSwitchForm(ByVal ProgressFormT1 As ProgressForSwitchForm)        Application.Run(ProgressFormT1)    End Sub    Private Sub EndProgressForm(ByVal ProgressFormT1 As ProgressForSwitchForm)        Try            ProgressFormT1.Close()        Catch ex As Exception        End Try    End Sub    ' 开始进度条    Public Sub StartProgressBar()        ProgressForSwitchFormT1 = New ProgressForSwitchForm()        ThreadT2 = New Threading.Thread(AddressOf ShowProgressForSwitchForm)        ThreadT2.Start(ProgressForSwitchFormT1)    End Sub    Friend Delegate Sub EndProgressForSwitchFormDelegate(ByVal ProgressFormT1 As ProgressForSwitchForm)    ' 结束进度条    Public Sub EndProgressBar()        Dim EndProgressForSwitchFormDelegateT1 As New EndProgressForSwitchFormDelegate(AddressOf EndProgressForm)        ProgressForSwitchFormT1.Invoke(EndProgressForSwitchFormDelegateT1, ProgressForSwitchFormT1)    End Sub    '''==================进度条End========================================================================#End Region
0 0
原创粉丝点击