C#ProgressBar初始显示不起作用

时间:2015-07-27 13:30:48

标签: c# progress-bar

我在带有进度条的Visual Studio 2010中遇到WinForm问题。我正在制作两个进度条来读取文件夹中的文件,一个用于文件数量,另一个用于行数量。进度条实例化,行进度条将显示标准绿色进度条,但文件进度条在更新或更新后才会显示任何内容。

我试过这个.progressbar1.Show()和this.progressbar1.Visible = true,在这种情况下它们不起作用。

感谢任何帮助:)

this.progressBar1.Location = new System.Drawing.Point(15, 25);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(373, 23);
this.progressBar1.TabIndex = 0;
this.progressBar1.Visible = true;
here is the methods in the program:

public ProgressBar()
{
    InitializeComponent();
}

public void SetTitle(string title)
{
    this.Text = title;
}

public void SetMessage(string txt)
{
    label1.Text = txt;
    label1.Refresh();
}

public void SetFile(string txt)
{
    label2.Text = txt;
    label2.Refresh();
}

private void timer1_Tick1(object sender, EventArgs e)
{
    this.Refresh();
}

public void SetValuesBar1(int i)
{
    progressBar1.Maximum = i;
    progressBar1.Minimum = 0;
    progressBar1.Value = 0;
}

public void SetValuesBar2(int i)
{
    progressBar2.Maximum = i;
    progressBar2.Minimum = 0;
    progressBar2.Value = 0;
}

0 个答案:

没有答案