似乎更新得太快了

似乎更新得太快了

本文介绍了TProgressBar 永远不会填满 - 似乎更新得太快了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
Windows 7 Aero 主题进度条错误?

从 Windows Vista 开始,我就注意到 Delphi 中的 TProgressBar 存在一个错误/问题.

Ever since Windows Vista, I have noticed a bug/problem with the TProgressBar in Delphi.

问题是进度条似乎永远不会填满 100%,有时在进度条认为它达到最大值之前可能会达到 70% - 80%,即 100%

The problem is the progressbar never seems to fill up to 100%, sometimes it gets to maybe 70% - 80% before the progressbar thinks its hit the max, i.e 100%

我一直在各种网站上阅读,事实上,进度条已经完成了它的操作.但是貌似Delphi VCL有一个bug,就是没有准确渲染进度条,所以当它看起来完整但实际上不完整时,这是因为进度条的绘制不准确.

I have been reading on various websites and infact, the progressbar has complete its operation. But it seems that there is a bug in the Delphi VCL which is not rendering the progressbar accurately, so when it appears to be complete but is actually not, this is because the painting of the progressbar is not accurate.

如果上述情况属实,这似乎是一个正当理由 - 我还没有找到解决方案.无论涉及 TProgressBar 的操作是什么,它永远不会填满 100%,它可能只会填满 75%.

If the above is true, which seems a valid reason - I have not found a solution to this. Whatever the operation which involves a TProgressBar, it never fills up 100%, it only fill maybe 75% of the way.

如何让 TProgressBar 准确填充?

How can I get the TProgressBar to fill up accurately?

补充一点,我尝试用 JVCL 中的进度条替换 TProgressBar,并且那些非标准 VCL 组件可以正常工作.所以这不是我处理进度的问题,它是 Delphi 或 Windows - 或两者兼而有之.

To add, I have tried replacing the TProgressBar with say a progressbar from the JVCL and those non standard VCL components work correctly. So it is not a problem with how I am dealing with the progress, it is either Delphi or Windows - or both.

是的,我可以使用上述替代方法,但如果可能的话,我想知道如何修复标准的 TProgressBar.

Yes, I could just use said alternative but if possible I would like to know how to fix the standard TProgressBar.

谢谢,克雷格.

推荐答案

这是 Vista 主题的功能.解决此功能的唯一已知方法是在更新期间向后退.

This is a feature of Vista themes. The only known way to work around this feature is to go backwards during an update.

每次将进度条计数器设置为 N 时,立即将其设置为 N-1.

Every time you set the progress bar counter to N immediately afterwards set it to N-1.

Delphi 代码没有问题,是通用控件的一个特性.

There's nothing wrong with the Delphi code, it's a feature of the common control.

这篇关于TProgressBar 永远不会填满 - 似乎更新得太快了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 23:32