后台工作者的问题
有人知道进度条的任何替代品吗?在我的项目中,我使用进度条。我想将其更改为旋转 gif 图像之类的内容,该图像指示处理或其他阻止用户与程序交互的标签。我尝试使用后台工作人员来实现 gif 图像,但它的挂起可能是因为巨大的文件传输过程。所以我正在寻找其他替代方案,例如标签,它将阻止用户与程序交互并以 % 显示进度。有人可以帮我解决这个问题吗?
could anybody knows any alternatives to progressbar? Inmy project im using progressbar..I would like to change it to something like a rotating gif image which indicates the processing or someother labels which prevents the user from interacting to the program.I tried to implement the gif image by using background worker but its hanging may be coz of huge file transfer process.. So im searching for someother alternative like a label which will prevent the user to interact with the program and shows the progress in % . Could anybody help me on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该在后台进行长时间运行的文件传输,而不是动画 gif。
You should be doing the long running file transfer in the background, not the animated gif.
从你的描述来看,你做事的方式似乎是错误的。应该在BackgroundWorker中运行的是长下载,而不是进度条/图片。进度更新需要在主 UI 线程中运行。使用 ReportProgress 方法告诉 UI 何时应该更新。 BackgroundWorker 实现会自动为您调用 Invoke,以便 UI 更新将在正确的线程上运行。
From your description it sounds like you're doing things the wrong way round. It is the long download that should run in the BackgroundWorker, not the progress bar / picture. The progress updates need to run in the main UI thread. Use the ReportProgress method to tell the UI when it should update. The BackgroundWorker implementation automatically calls Invoke for you, so that the UI updates will run on the correct thread.