Skip to main content
 首页 » 编程设计

c#之不可测量外部过程的渐近进度条

2024年02月23日20qq78292959

当程序正在等待外部进程完成且无法衡量其进度时,进度条应该做什么?

我注意到这个答案建议使用 Marquee 风格的进度条:https://stackoverflow.com/a/6357655/327528

但是如果有一个渐近进度条会变得越来越慢,直到由于像素不能无限小而逐渐停止。这是个好主意吗?您将如何实现?

请用 VB6 和 C# 中的一种或两种方式给出答案。

请您参考如下方法:

你不应该这样的渐近进度条。您应该改用“不确定进度条”(参见以下链接)。

Microsoft 用户体验 (UX) 设计指南为进度条提供了明确的规则 here :

Use indeterminate progress bars for operations that require an unbounded amount of time or that access an unknown number of objects. Use timeouts to give bounds to time-based operations.

(我的亮点。)

  • Clearly indicate lack of progress. The progress bar must not advance if no progress is being made. You don't want users to wait indefinitely for an operation that is never going to complete.

[编辑]

为了更好的可读性,我在此添加我从评论中添加的信息。

WPF 演练:如何实现 A Modern Progress Dialog For WPF Applications

此外,如果您想改用动画,Visual Studio 会在所有版本(我认为 Express 版本除外)中提供一个图标库,并允许在您的项目中使用这些图标: Visual Studio Image Library . 您必须先从 ZIP 格式中提取它们,但我相信您会掌握这项任务..;-)

然后您可以在子文件夹 \Animations 中找到 GIF 动画 status_anim.gif。