首页 > 解决方案 > c#我如何重置进程栏并重新启动它

问题描述

在 WFA (c#) 中,我有进程栏。我有 2 个进程,并且希望每次启动进程时都显示进程栏。但它不起作用!:

    public void ProcessStart(int ProcessMaximumValue)
    {
        progressBar.Maximum = ProcessMaximumValue;
    }

    public void ProcessEnd()
    {
        progressBar.Value = 0;
    }

        ProcessStart(4);
        for (int i = 1; i < 5; i++)
        {
            progressBar.PerformStep();
        }
        ProcessEnd();


        ProcessStart(3);
        for (int i = 1; i < 4; i++)
        {
            progressBar.PerformStep();
        }
        ProcessEnd();

标签: c#progress-bar

解决方案


如果您的步长为 1,则需要将 设置为 1,例如:progressBar.Step = 1; PerformStep() 将 Step 值添加到 progress.value 上。


推荐阅读