当我的应用程序运行子程序时,如何保持动画gif运行. 整个用户界面被阻止,所以我尝试以另一种形式显示它,但我得到了相同的结果. 两件事情: 使用BackgroundWorker(下面的示例) 如果可以
整个用户界面被阻止,所以我尝试以另一种形式显示它,但我得到了相同的结果. 两件事情:
>使用BackgroundWorker(下面的示例)
>如果可以,请使用不确定的进度条,但这取决于所使用的技术.
BG工作者的例子:
Private wrkDeploy As New BackgroundWorker() Private Sub wndMain_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) AddHandler wrkDeploy.DoWork, AddressOf wrk_DoWork AddHandler wrkDeploy.RunWorkerCompleted, AddressOf wrk_RunWorkerCompleted End Sub Private Sub wrk_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs) ' Hide Gif and start normal UI process again End Sub Private Sub wrk_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs) ' Do all heavy work here End Sub Private Sub btnFilter_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) ' Show GIF and disable whatever you need to wrkDeploy.RunWorkerAsync() End Sub