ProgressBar加载后如何显示按钮?

时间:2017-12-28 13:29:23

标签: c#

我是C#的新手并开始制作自己的程序。但是,我希望这些(https://gyazo.com/8b4e0f4141b15e1ff204e1cfc8f41827)消失,直到我的进度条加载(https://gyazo.com/5064ebd9582593942c6e538e1ae516dc)。我试图使用Visible但无处可去。

ProgressBar代码:

private void button1_Click(object sender, EventArgs e)
{
    this.timer1.Start();
}

private void progressBar1_Click(object sender, EventArgs e)
{
}

private void timer1_Tick(object sender, EventArgs e)
{
    var before = this.progressBar1.Value;
    this.progressBar1.Increment(1);
    var after = this.progressBar1.Value;

    if (after > before && after == this.progressBar1.Maximum)
    {
        MessageBox.Show("Successfully loaded...");
        this.BackgroundImage = Properties.Resources.image1;              
    }
}

1 个答案:

答案 0 :(得分:1)

在“Form.Load”中设置Image.Visible = false并在显示MessageBox时设置Image.Visible = true