简体   繁体   English

如何在C#中的WinForm应用程序中使用进度条

[英]how to use progress bar in WinForm Application in C#

i need to use Progress bar in my application. 我需要在应用程序中使用进度栏。

It takes more than two minutes to compete the process but it may vary based on the situation 竞争过程需要两分钟以上的时间,但可能会因情况而异

Can i use progress Bar to show the the progress of the application without knowing the maximum limit and step value 我可以在不知道最大限制和步长值的情况下使用进度条显示应用程序的进度吗

When the end condition is not known or cannot be calculated, the best it to give some indication to the user that the application is busy performing the requested operation. 当结束条件未知或无法计算时,最好向用户提供一些指示,表明应用程序正忙于执行所请求的操作。 In this case, the Progress Bar can be set to be used as a Marquee (An Ever Looping Progress Bar) link text 在这种情况下,可以将进度条设置为用作选取框(无循环循环进度条) 链接文本

If you have some idea about how long it will take you could just set the max to 100 and slowly update it but making sure that it'll never reach 100 before it's finished, and then when it is finished you just jump to 100. It looks a little funny, but it's fairly common still. 如果您知道需要多长时间,可以将最大值设置为100并缓慢更新,但要确保它在完成之前永远不会达到100,然后在完成时您只需跳到100即可。看起来有点可笑,但这仍然很普遍。 If you have no idea at all how long it would take I'd suggest that a progress bar is not the solution, rather you'd want to use some other kind of animation to show progress without giving a false impression on how long it'll take (I really hate progress bars that go up to 95% or something and then jumps back to 40%). 如果您根本不知道需要多长时间,我建议您不要使用进度条来解决问题,而是您希望使用其他类型的动画来显示进度,而又不会给人以多长时间的错误印象。会接受的(我真的很讨厌进度条,它会上升到95%左右,然后又回升到40%)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM