Windows窗体进度:启动/停止选取框最简单的方法? [英] Windows Forms ProgressBar: Easiest way to start/stop marquee?
问题描述
我使用C#和Windows窗体。我有一个正常的进度条在节目罚款的工作,但现在我有那里的持续时间不能很容易地计算其他操作。我想显示一个进度条,但不知道要启动/停止滚动字幕的最佳途径。我希望的是设置字幕的速度,然后有一个start(这样简单的事情)和stop(),但它似乎并没有那么简单。我一定要在后台运行一个空的循环?我最好如何做到这一点?谢谢
I am using C# and Windows Forms. I have a normal progress bar working fine in the program, but now I have another operation where the duration cannot be easily calculated. I would like to display a progress bar but don't know the best way to start/stop the scrolling marquee. I was hoping for something as simple as setting the marquee speed and then having a start() and stop() but it doesn't appear to be that simple. Do I have to run an empty loop in the background? How do I best do this? Thanks
推荐答案
使用一个进度条设置为字幕
的风格。这将重新presents一个不确定的进度条。
Use a progress bar with the style set to Marquee
. This represents an indeterminate progress bar.
myProgressBar.Style = ProgressBarStyle.Marquee;
您也可以使用<$c$c>MarqueeAnimationSpeed$c$c>属性来设置它需要多长时间颜色的小方块在你的进度条动画。
You can also use the MarqueeAnimationSpeed
property to set how long it will take the little block of color to animate across your progress bar.
这篇关于Windows窗体进度:启动/停止选取框最简单的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!