gpt4 book ai didi

vb.net - 运行子程序时显示动画 gif

转载 作者:行者123 更新时间:2023-12-03 00:33:22 26 4
gpt4 key购买 nike

当我的应用程序运行子程序时,如何保持 gif 动画运行。整个用户界面被阻止,所以我尝试以另一种形式显示它,但我得到了相同的结果。

最佳答案

有两件事:

  • 使用BackgroundWorker(示例如下)
  • 如果可以的话,最好使用不确定的进度条,但这取决于所使用的技术。

BG Worker 示例:

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

关于vb.net - 运行子程序时显示动画 gif,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2251731/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com