gpt4 book ai didi

delphi - 将 'StepIt' 从 ProgressBar 替换为 cxProgressBar

转载 作者:行者123 更新时间:2023-12-02 01:53:32 24 4
gpt4 key购买 nike

我刚刚用 cxProgressBar 替换了常见的进度条,但是我注意到它没有“StepIt”方法。

我用这个替换了 StepIt:

progressbar1.Position := progressbar1.Position+1;

我认为这不是最好的选择,因为 Progress 比 StepIt 慢得多。

为了设置最大值,我获取了 sql 表上将被转换为本地缓存的字段总数。

除了常见的 ProgressBar 之外,我从未尝试过任何其他东西,这就是我遇到此问题的原因。

谢谢。

最佳答案

来自在线帮助:http://docwiki.embarcadero.com/VCL/en/ComCtrls.TProgressBar.StepIt

Advances Position by the amount specified in the Step property.

Call the StepIt method to increase the value of Position by the value of the Step property. If Step represents the size of one logical step in the process tracked by the progress bar, call Step after each logical step is completed.

下面的代码应该可以解决问题。

procedure MyStepIt(NrOfSteps);
var
Step: integer;
begin
Step:= Max(1,(ProgressBar1.Max - ProgressBar1.Min) div NrOfSteps);
ProgressBar1.Position:= Min(ProgressBar1.Max, ProgressBar1.Position + Step);
end;

关于delphi - 将 'StepIt' 从 ProgressBar 替换为 cxProgressBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5796541/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com