如何连接进度指示器

发布于 2024-08-18 01:14:16 字数 225 浏览 9 评论 0原文

我有一个圆形进度指示器。我想将此进度条添加到我正在开发的应用程序中,但不知道如何正确连接它。

在我的应用程序中,我想点击“处理”按钮并在处理数据时显示进度条。处理完成后,我希望隐藏进度条。

我不希望在进度条隐藏后进行处理。我希望进度条与数据处理同时运行(就像进度条应该工作一样)。我不记得步骤了,但在某一时刻,这种情况发生了。

我需要做什么?您能推荐一些简单的示例来展示如何实现进度条吗?

I have a circular progress indicator. I'd like to add this progress bar to an application I'm working on but don't know how to wire it up correctly.

In my app, I want to hit the "Process" button and have the progress bar displayed while the data is being processed. When the processing is complete, I want the progress bar to hide.

I don't want the processing to occur AFTER the progress bar is hidden. I want the progress bar to run concurrently with the data processing (like a progress bar should work). I don't remember the steps but at one point this was happening.

What do I need to do? Can you recommend and simple examples that show how to implement a progress bar?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不疑不惑不回忆 2024-08-25 01:14:16

这就是 BackgroundWorker 类的用途。文档中的示例显示了一个长时间运行的工作线程,它报告进度并更新 UI 上的进度栏。

This is what the BackgroundWorker class is made for. The example in the documentation shows a long running work thread, which reports progress and updates a progress bar on the UI.

野心澎湃 2024-08-25 01:14:16

您应该在单独的线程中运行进程,当该线程运行时,您可以让进度指示器在 GUI 线程上运行。 (如果您希望应用程序在进程运行时被阻止)使用回调委托,您可以让 GUI 线程知道正在运行的进程的状态以及是否终止进度指示器(当进程完成时)或保持其运行。

You should run your process in a seperate thread and while that thread is running you can have your progress indicator running on the GUI thread. (If you want your application to be blocked while the process is running) With a callback delegate you can let your GUI thread know the state of the running process and whether to kill the progress indicator (when process is finished) or to keep it running.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文