加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 如何使TProgressBar停止滞后?

发布时间:2020-12-15 09:44:08 所属栏目:大数据 来源:网络整理
导读:我有一个运行一系列操作的应用程序,我正在尝试使用TProgressBar来跟踪正在发生的事情.我设置了许多步骤,并调用.StepIt来增加进度条. 问题是,它没有很好地跟上.它似乎喜欢逐渐滑向它,而不是直接跳到正确的位置.如果它是你所追求的眼睛糖果,这一切都很好,但是
我有一个运行一系列操作的应用程序,我正在尝试使用TProgressBar来跟踪正在发生的事情.我设置了许多步骤,并调用.StepIt来增加进度条.

问题是,它没有很好地跟上.它似乎喜欢逐渐滑向它,而不是直接跳到正确的位置.如果它是你所追求的眼睛糖果,这一切都很好,但是当我试图准确地表达我的例程进展时,这使得它似乎总是落后于真实状态.如何关闭“功能”?

我只注意到在Windows Vista下发生这种情况.不确定它是否也在XP上进行,因为当我在XP上测试它时,过程进行得更快,而且过快. :P但这可能是也可能不是特定于Vista的.无论哪种方式,它都让我疯狂.有谁知道如何修理它?

解决方法

我刚才遇到了完全相同的问题.在搜索谷歌很长一段时间后,我发现这是一个特定于Vista的问题.它似乎归结为:微软为Vista中的进度条控件添加了精美的动画(即移动的’突出显示’).为了使更新更加顺畅,他们在控件的重绘中实现了某种“滞后” – 这基本上会使整个进度条控制起来.我会说,相当烦人,特别是因为似乎没有一个像样的解决方案.

有关详细信息,请参阅Arvid Winkelsdorf对this Embarcadero Discussion Forum post的回复:

It’s the same for VB,C++ and C#
somehow as the problem lies in the
Vista drawing of the new animated
ProgressBars. To provide a smoother
visual feedback drawing is delayed
when moving forward. Your application
cannot be sure that 100% will be
reached at any given time.

By setting the position back to a
smaller value,the ProgressBar drawing
is forced to jump back. No delay in
getting to a position smaller than the
current. So you’ll have nearly 100%
immediately. Afterwards set to the
maximum and you’ll have exactly 100%.

[…]

There is a similar glitch when using the new Vista ProgressBar Styles like PB Paused or PB Error. If the bar is still moving (MS part) and your app sets the color to paused by SendMessage (like in D2009) the message will be ignored by the ProgressBar.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读